Last Updated on November 12, 2024 by Mathew Diekhake
I want to list the running containers in Docker. I have already learned how to build and run Docker containers but cannot work out how to list the containers. If you could show me how to list all Docker containers, list all the running Docker containers, and list the stopped Docker containers that would be great. Resolution:
The following tutorial demonstrates how to list running Docker containers via the Docker command line.
Docker magrkes it easy to run applications. The docker exec
command runs a new command in a running container. After you have started a aDocker container, you can use the docker ps
command to list the running doc containers. Docker also makes it possible to list every Docker container that has been started; you can also filter Docker to show the stopped conatiners only.
List All Docker Containers
You can list all of the Docker containers with the following commands:
$ docker ps -a
OR
$ docker ps --all
List Running Docker Containers
You can list the running Docker containers with the following command:
$ docker ps
List Stopped Docker Containers
You can list the stopped Docker containers with the following commands:
$ docker ps --filter "status=exited"
OR
$ docker ps -f "status=exited"
In conclusion, that is how to list running Docker containers. You can also use this tutorial to see all Docker containers and list the stopped Docker containers.
Related Tutorials
- Bash Colors [Tutorial]
- Batch File Comment [Tutorial]
- Windows Grep Equivalent [Tutorial]
- How to Fix Windows 10 Black Screen with Cursor Before/After Login [Tutorial]
Roy Morita
May 21, 2022 @ 17:14
Thanks very much. This is exactly what I was looking for. If I run a Docker image as a container with tags, should I expect them to show up under the listed containers? Because I’m currently not seeing it.
Mat Diekhake
May 21, 2022 @ 17:25
Hello Roy,
The
docker ps
command lists the containers but not images. However, you can create images from containers by using thedocker commit
command.You can also run the
$ docker images
command to get the list of all Docker images and their tag names and then run the$ docker run image_name:tag_name
command, being sure to change the “tag_name” with the actual tag name.