List Docker Containers with docker ps command
Let's sell How to List docker containers with docker ps command.
To list running containers, Type:
docker ps
To list all docker containers, including containers that are not running, type:
docker ps -a
As above screenshot shows, information includes CONTAINER ID, IMAGE which used to create the container, Status, Ports Mapping and name of the Container.
The -f or --filter= option can be used to filter the output. For example, To list all exited containers, Type:
docker ps -f status=exited
Examples
Print docker ps Command Help:
docker ps --help
Show the latest created container:
docker ps -l
Display the Size of the all running containers:
docker ps -s
Display 2 Last created docker containers:
docker ps -n 2