0
0
Dockerdevops~5 mins

docker compose up and down - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the command docker compose up do?
It starts all the services defined in the docker-compose.yml file, creating containers if they don't exist.
Click to reveal answer
beginner
What is the purpose of docker compose down?
It stops and removes all containers and networks created by docker compose up.
Click to reveal answer
beginner
How can you run docker compose up in detached mode?
Add the -d flag: docker compose up -d. This runs containers in the background.
Click to reveal answer
intermediate
What happens if you run docker compose up and the containers already exist?
Docker Compose will start the existing containers without recreating them unless the configuration has changed.
Click to reveal answer
intermediate
Can docker compose down remove volumes? How?
Yes, by adding the -v flag: docker compose down -v removes volumes created by Compose.
Click to reveal answer
What does docker compose up -d do?
ABuilds images only
BStarts containers in the background
CRemoves containers and networks
DStops all running containers
Which command stops and removes containers created by Docker Compose?
Adocker compose run
Bdocker compose start
Cdocker compose build
Ddocker compose down
How do you remove volumes when bringing down Docker Compose services?
Adocker compose down -v
Bdocker compose rm -v
Cdocker compose down --remove-volumes
Ddocker volume rm
If containers already exist, what does docker compose up do?
AStarts existing containers without recreating
BDeletes and recreates containers
CDoes nothing
DOnly builds images
Which file does Docker Compose use to define services?
Acompose.yaml
BDockerfile
Cdocker-compose.yml
Ddockerfile.yml
Explain what happens when you run docker compose up and how you can run it in the background.
Think about starting containers and running them without blocking your terminal.
You got /3 concepts.
    Describe the purpose of docker compose down and how it affects containers, networks, and volumes.
    Consider how to clean up everything Docker Compose created.
    You got /3 concepts.