Home>Article>Operation and Maintenance> How docker check the status of the container
In docker, you can use the ps command to view the status of the container. This command is used to list the containers. When the parameter is set to "-a", it can display the status of all containers including those that are not running. The syntax is: "docker ps -a".
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
docker ps: List containers
Syntax
docker ps [OPTIONS]
OPTIONS description:
-a :Shows all containers, including those that are not running.
-f : Filter the displayed content based on conditions.
--format: Specify the template file for the return value.
-l : Display recently created containers.
-n: List the recently created n containers.
--no-trunc: Do not truncate the output.
-q: Silent mode, only the container number is displayed.
-s: Display the total file size.
Instance
Lists all running container information.
runoob@runoob:~$ docker ps CONTAINER ID IMAGE COMMAND ... PORTS NAMES 09b93464c2f7 nginx:latest "nginx -g 'daemon off" ... 80/tcp, 443/tcp myrunoob 96f7f14e99ab mysql:5.6 "docker-entrypoint.sh" ... 0.0.0.0:3306->3306/tcp mymysql
Output details:
CONTAINER ID: Container ID.
IMAGE: The image used.
COMMAND: The command to run when starting the container.
CREATED: The creation time of the container.
STATUS: Container status.
There are 7 states:
created (created)
restarting (restarting )
running
removing
paused )
exited (stop)
dead (death)
PORTS: The port of the container Information and connection type used (tcp\udp).
NAMES: Automatically assigned container names.
Recommended learning: "docker video tutorial"
The above is the detailed content of How docker check the status of the container. For more information, please follow other related articles on the PHP Chinese website!