How to List Containers in Docker?

Better Stack Team
Updated on August 1, 2022

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
Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →