To first find the list of containers with a specific status you can use the filter option of the docker ps command in order to filter out those with the required status as follows.
Filter containers docker.
Filter by exit signal.
It is the de facto standard for container deployment and it is an essential tool for devops engineers and their continuous integration and delivery pipeline.
Docker ps filter status your status.
Where your status can be one of the following.
Docker ps options list containers options.
Docker container inspect foo f state status config image running foo image latest.
A all show all containers default shows just running f filter filter filter output based on conditions provided format string pretty print containers using a go template n last int show n last created containers includes all states default 1 l.
A docker container image is a lightweight standalone executable package of software that includes everything needed to run an application.
Docker container inspect foo instead and you can format the output to get whatever data you need from that.
To show the current status and image.
Description list containers usage docker container ls options options name shorthand default description all a show all containers default shows just running filter f filter output based on.
Code runtime system tools system libraries and settings.
This is the most powerful command.
Docker is a containerization platform that allows you to quickly build test and deploy applications as portable self sufficient containers that can run virtually anywhere.
To see all containers on the docker host including stopped containers use docker ps a you may be surprised how many containers exist especially on a development system.
Created running restarting removing exited paused and dead.
The docker container prune command allows you to remove containers based on a certain condition using the filter option.
When you stop a container it is not automatically removed unless you started it with the rm flag.
At the time of the writing of this article the currently supported filters are until and label.
See the docker image prune reference for more examples.
Docker ps a filter exited 137 container id image command created status ports names b3e1c0ed5bfe ubuntu latest sleep 1000 12 seconds ago exited 137 5 seconds ago grave kowalevski a2eb5558d669 redis latest entrypoint sh redi 2 hours ago exited 137 2.
You can use a filter to locate containers that exited with status of 137 meaning a sigkill 9 killed them.