Listing All Containers
Part of the Introduction to Docker section of Coddy's Terminal journey — lesson 14 of 40.
Plain docker ps only shows containers that are currently running. Containers that have already exited disappear from that list, but they are not gone.
Add the -a (all) flag to see every container, running or stopped:
docker ps -aThe STATUS column tells you which is which: a running container shows Up ..., while a finished one shows Exited (0) .... This is how you find a short-lived container after it has already stopped.
Challenge
EasyRun an alpine container named quicktask that echoes hi (it exits immediately), then list all containers so the exited one still appears.
Cheat sheet
Use docker ps -a to list all containers, including stopped ones:
docker ps -aThe STATUS column shows Up ... for running containers and Exited (0) ... for finished ones.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Introduction to Docker
4Managing Containers
Naming ContainersDetached ContainersListing All ContainersStopping And RemovingRecap - Container Lifecycle