0
0
Dockerdevops~20 mins

docker compose up and down - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Compose Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of docker compose up when the service is already running?
You run docker compose up on a project where the containers are already running. What will happen?
ADocker Compose will attach to the existing containers and show their logs.
BDocker Compose will recreate all containers regardless of their current state.
CDocker Compose will throw an error saying containers are already running.
DDocker Compose will stop the running containers and start new ones.
Attempts:
2 left
💡 Hint
Think about how Docker Compose behaves to avoid restarting containers unnecessarily.
💻 Command Output
intermediate
2:00remaining
What happens when you run docker compose down?
You have a Docker Compose project running. You execute docker compose down. What is the result?
AIt removes only the containers but leaves networks and volumes running.
BIt only stops the containers but keeps networks and volumes intact.
CIt stops and removes containers and networks created by <code>up</code>.
DIt restarts the containers without removing anything.
Attempts:
2 left
💡 Hint
Consider what down means compared to stop.
🔀 Workflow
advanced
2:00remaining
Order the steps to safely update a service using Docker Compose
You want to update a service defined in your Docker Compose file. Put these commands in the correct order to update the service without downtime.
A3,1,4,2
B1,2,4,3
C1,2,4
D1,2
Attempts:
2 left
💡 Hint
Think about updating only the service without stopping the whole project.
Troubleshoot
advanced
2:00remaining
Why does docker compose down not remove volumes by default?
You ran docker compose down but noticed your volumes still exist. Why does this happen?
AVolumes are persistent by design and must be removed explicitly with <code>--volumes</code> flag.
BDocker Compose has a bug that prevents volume removal.
CVolumes are removed only if containers are stopped manually before running <code>down</code>.
DVolumes are removed only if you use <code>docker compose stop</code> before <code>down</code>.
Attempts:
2 left
💡 Hint
Think about data safety and persistence in Docker volumes.
Best Practice
expert
2:00remaining
Which command sequence is best to completely reset a Docker Compose environment including volumes?
You want to completely reset your Docker Compose environment, removing containers, networks, and volumes. Which command sequence achieves this safely?
Adocker compose down --volumes && docker network prune
Bdocker compose down --rmi all --volumes
Cdocker compose down && docker volume prune
Ddocker compose stop && docker compose rm -v && docker network prune
Attempts:
2 left
💡 Hint
Consider removing images, volumes, and networks in one command.