You can use docker container ls command to list containers in Docker.
Syntax:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Usage: docker container ls [OPTIONS] docker ps [OPTIONS] Aliases: ls, ps, list Options: -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, --latest Show the latest created container (includes all states) --no-trunc Don"t truncate output -q, --quiet Only display numeric IDs -s, --size Display total file sizes |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
## List only running docker containers. docker container ls ## List all docker containers. docker container ls -a ## List latest created docker container docker container ls -l ## List latest n docker containers docker container ls -n=5 ## List docker containers with total file size. docker container ls -s ## List only docker container IDs docker container ls -q ## List docker containers having certain properties using filter docker container ls -f status=running docker container ls -f status=exited ## In old docker version use docker ps command to list containers. docker ps -a |