English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Docker ps command (Docker ps command)

Docker Command大全

docker ps : (docker ps :) list containers (list containers)

Syntax (Syntax)

docker ps [OPTIONS] (docker ps [OPTIONS])

OPTIONS explanation: (OPTIONS explanation:)

  • -a : (a :)display all containers, including those not running. (display all containers, including those not running.)

  • -f : (f :)filter and display content based on conditions. (filter and display content based on conditions.)

  • --format : (format :)specify the template file for the returned value. (specify the template file for the returned value.)

  • -l : (l :)display the last created container. (display the last created container.)

  • -n : (n :)list the last n created containers. (list the last n created containers.)

  • --no (no)-trunc : (trunc :)do not truncate output. (do not truncate output.)

  • -q : (q :)silent mode, only display container ID. (silent mode, only display container ID.)

  • -s : (s :)display total file size. (display total file size.)

online examples (online examples)

list information of all running containers. (list information of all running containers.)

w3codebox@w3codebox:~$ docker ps
CONTAINER ID IMAGE COMMAND ... PORTS ... NAMES
09b93464c2f7   nginx:latest "nginx -g 'daemon off" ...  80/tcp, 443/tcp myw3codebox
96f7f14e99ab mysql:5.6      "docker-entrypoint.sh" ... 0.0.0.0:3306->3306/tcp mymysql

output details introduction: (output details introduction:)

CONTAINER ID: (CONTAINER ID:) container ID. (container ID.)

IMAGE: (IMAGE:) used image. (used image.)

COMMAND: (COMMAND:) command executed when starting the container. (command executed when starting the container.)

CREATED: (CREATED:) container creation time. (container creation time.)

STATUS: (STATUS:) container status. (container status.)

status: (status:)7type: (type:)

  • created (created)

  • restarting (restarting)

  • running (running)

  • removing (migrating)

  • paused (paused)

  • exited (stopped)

  • dead (dead)

PORTS: Container port information and the type of connection used (tcp\udp).

NAMES: automatically assigned container name.

List the recently created5container information.

w3codebox@w3codebox:~$ docker ps -n 5
CONTAINER ID...           
09b93464c2f7        nginx:latest... -g 'daemon off"    2 days ago...     
b8573233d675        nginx:latest.../bin/bash"               2 days ago...     
b1a0703e41e7        nginx:latest... -g 'daemon off"    2 days ago...    
f46fb1dec520        5c6e1090e771        "/bin/sh -c 'set -x \t"   2 days ago...   
a63b4a5597de        860c279d2fec...                    2 days ago...

List all created container IDs.

w3codebox@w3codebox:~$ docker ps -a -q
09b93464c2f7
b8573233d675
b1a0703e41e7
f46fb1dec520
a63b4a5597de
6a4aa42e947b
de7bb36e7968
43a432b73776
664a8ab1a585
ba52eb632bbd
...

Docker Command大全