Challenge - 5 Problems
Container Listing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Output of
docker ps commandYou run
docker ps on a system with three containers: one running, two stopped. What will docker ps show?Docker
docker ps
Attempts:
2 left
💡 Hint
Remember,
docker ps shows only running containers by default.✗ Incorrect
The docker ps command lists only containers that are currently running. Stopped containers are not shown unless you add the -a option.
💻 Command Output
intermediate1:30remaining
Output of
docker ps -a commandYou run
docker ps -a on a system with two running and two stopped containers. What will the command output include?Docker
docker ps -a
Attempts:
2 left
💡 Hint
The
-a option means 'all' containers.✗ Incorrect
The docker ps -a command lists all containers, whether running or stopped, showing their status.
❓ Troubleshoot
advanced2:00remaining
Why does
docker ps show no containers?You run
docker ps but it shows no containers, even though you know containers exist on the system. What is the most likely reason?Docker
docker ps
Attempts:
2 left
💡 Hint
Think about what
docker ps shows by default.✗ Incorrect
docker ps shows only running containers. If none are running, it will show no containers.
✅ Best Practice
advanced1:30remaining
Best command to list all containers including stopped ones
Which command should you use to see all containers, including those that have stopped?
Attempts:
2 left
💡 Hint
The
-a option means 'all'.✗ Incorrect
docker ps -a lists all containers, running or stopped. docker container ls is equivalent to docker ps and shows only running containers. The -q option shows only IDs.
🧠 Conceptual
expert2:30remaining
Understanding container listing filters
You want to list only containers that exited with a non-zero status. Which command will do this?
Attempts:
2 left
💡 Hint
The filter 'exited' takes an exit code number.
✗ Incorrect
The --filter "exited=1" option lists containers that exited with status 1 (non-zero). Using exited=0 lists containers that exited successfully. The syntax exited!=0 is invalid. status=exited lists all exited containers regardless of exit code.