DEV Community

Cover image for Command to list docker containers
Adrian Matei for Codever

Posted on • Edited on • Originally published at codever.dev

Command to list docker containers

To list the docker running containers use the following command:

docker ps
Enter fullscreen mode Exit fullscreen mode

To show all running containers use the -a (--all) option:

docker ps -a
Enter fullscreen mode Exit fullscreen mode

If you want to filter, by name for example you can use the --filter option with the name=containing_text value

$ docker ps --filter "name=codever"
8a01ae8ef526   jboss/keycloak:6.0.1   "/opt/jboss/tools/do…"   3 days ago      Exited (255) 10 hours ago   0.0.0.0:8480->8080/tcp     codever-keycloak
f7c51c81dc4f   mongo:3.4              "docker-entrypoint.s…"   3 days ago      Exited (255) 10 hours ago   0.0.0.0:27017->27017/tcp   codever-mongo
5b2f88b9fe57   postgres               "docker-entrypoint.s…"   3 days ago      Exited (255) 10 hours ago   5432/tcp                   codever-postgres
Enter fullscreen mode Exit fullscreen mode

You could also obtain similar results if piping the docker ps command to grep - docker ps -a | grep codever


Reference -

https://docs.docker.com/engine/reference/commandline/ps/


Shared with ❤️ from Codever. Use 👉 copy to mine functionality to add it to your personal snippets collection.

Top comments (0)