Home  >  Article  >  Operation and Maintenance  >  How docker check the status of the container

How docker check the status of the container

WBOY
WBOYOriginal
2022-03-08 11:22:0616023browse

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".

How docker check the status of the container

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

How docker checks the status of containers

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn