W3Reference.com
Toggle Menu
Home
Online Rust Compiler
Tutorials
Python Tutorial
Java Tutorial
Rust Tutorial
TypeScript Tutorial
ReactJS Tutorial
HTML & CSS Basics
Docker Containers Guide
Kubernetes Tutorial
Software Design Patterns
Blog
All Posts
Docker Compose and Multi-Container Applications
Review your knowledge of orchestrating multi-service environments using Docker Compose.
1. What is the default filename for a Docker Compose configuration file?
docker-compose.yml
docker-compose.yaml
Both a and b
docker.yml
2. What does 'docker-compose up --build' do?
Starts services without building images
Builds images before starting services
Deletes existing containers
Scales services to 2 instances
3. The 'depends_on' option in a service specifies:
Network dependencies
Volume mounts
Service startup order
Environment variables
4. Which command stops and removes containers, networks created by 'docker-compose up'?
docker-compose stop
docker-compose rm
docker-compose down
docker-compose kill
5. What is the purpose of the top-level 'networks' key in docker-compose.yml?
Define environment variables for all services
Create custom networks for services to connect
Specify volume mounts for services
Set restart policies for containers
6. Which command views the status of all services in docker-compose.yml?
docker-compose status
docker-compose list
docker-compose ps
docker-compose services
7. How to scale a service named 'web' to 3 instances with docker-compose?
docker-compose scale web=3
docker-compose up --scale web=3
docker-compose run --scale 3 web
docker-compose start --scale web=3
8. Which are top-level keys in a valid docker-compose.yml? (Select all that apply)
services
networks
volumes
images
configs
9. Which commands stop running services in docker-compose.yml? (Select all that apply)
docker-compose stop
docker-compose down
docker-compose kill
docker-compose pause
docker-compose rm
10. Which options set environment variables for a service? (Select all that apply)
environment
env_file
env
environment_vars
env_vars
11. What happens with 'docker-compose up -d'? (Select all that apply)
Services start in foreground
Services start in detached mode
Containers run in background
Logs printed to console
Services scaled to 2 instances
12. Which are valid volume types in docker-compose.yml? (Select all that apply)
named volumes
bind mounts
tmpfs mounts
network volumes
cloud volumes
13. 'docker-compose down' by default removes volumes created by the compose file.
True
False
14. 'depends_on' ensures a dependent service is fully ready (e.g., database accepts connections) before starting.
True
False
15. Docker Compose allows overriding settings with ${VAR} environment variable syntax in docker-compose.yml.
True
False
16. 'docker-compose logs' displays logs for all running services by default.
True
False
17. What command starts all services in docker-compose.yml in detached (background) mode?
18. What key under a service defines direct environment variables (not from a file) in docker-compose.yml?
19. What flag is added to 'docker-compose down' to remove volumes created by the compose file?
20. What is the default filename for Docker Compose environment variables (without extension)?
Reset
Answered 0 of 0 — 0 correct