How to List Containers in Docker?
Running containers
If you want to list all the running docker containers, you can use the docker container ls
command, which takes the following form:
docker container ls
This command is valid on all newer versions of docker (1.13 or newer). For older docker version, use the following command
docker ps
This command is still available on new docker versions, but it is alias to the docker container ls
command.
This is the expected output of the command:
Output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c8bdef56da86 ubuntu "docker-entrypoint.s…" 15 hours ago Up 1 hours 5432/tcp name
752g3a115fcf postgres "docker-entrypoint.s…" 17 hours ago Up 1 hours 6379/tcp name
All containers
To display all containers (the non-running included) you can use the -a option:
docker container ls -a
-
How to Remove a Docker Image?
To remove one or more specific images, you can use the docker rmi command. How to list all images If you want to list all the images before removing any, you can do they by running the following co...
Questions -
How to Include Files outside of Docker’s Build Context?
You may have ended up in a situation where you wanted to include a file from outside of Docker's build context using the ADD command, but the ADD command requires the path to be within the build co...
Questions -
What Is the Difference between CMD and ENTRYPOINT in a Dockerfile?
There is a big confusion around similarity and lack of clarity in the difference between the CMD and ENTRYPOINT instruction in Docker. Let’s clear things up. See the example Let’s say we want to cr...
Questions -
How to Mount a Host Directory in a Docker Container?
If you want to mound a host directory in a Docker container, you have to main ways to do that: Using the ADD command: The simplest way is to use the dockers ADD command as shown below: ADD . /path/...
Questions
We are hiring.
Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.
Help us in making the internet more reliable.

Help us with developer education and get paid.
