List Docker containers.
# To list currently running docker containers:
docker ps
# To list all docker containers (running and stopped):
docker ps --all
# To show the latest created container (includes all states):
docker ps --latest
# To filter containers that contain a substring in their name:
docker ps --filter="name=<name>"
# To filter containers that share a given image as an ancestor:
docker ps --filter "ancestor=<image>:<tag>"
# To filter containers by exit status code:
docker ps --all --filter="exited=<code>"
# To filter containers by status (created, running, removing, paused, exited and dead):
docker ps --filter="status=<status>"
# To filter containers that mount a specific volume or have a volume mounted in a specific path:
docker ps --filter="volume=<path/to/directory>" --format "table <.ID>\t<.Image>\t<.Names>\t<.Mounts>"