How can you check the status of a specific container in Docker?

To check the status of a specific container, use the following command:

docker container inspect <容器名或ID> --format="{{.State.Status}}"

The is the name or ID of the container whose status needs to be retrieved.

This command will return the status of the container, such as “running” or “exited”.

Additionally, you can use the command “docker ps” to list the status of all containers.

docker ps --format "{{.Names}}: {{.Status}}"

This command will list the names and statuses of all containers.

广告
Closing in 10 seconds
bannerAds