Complete the code to start services defined in a Compose file.
docker-compose [1]The docker-compose up command starts all services defined in the Compose file.
Complete the code to run Compose in detached mode (in the background).
docker-compose up [1]The -d flag runs containers in detached mode, so the terminal is free after starting.
Fix the error in the Compose command to remove stopped containers.
docker-compose [1]The docker-compose rm command removes stopped service containers.
Fill both blanks to specify a Compose file and project name.
docker-compose [1] docker-compose.yml [2] myproject up
The -f flag specifies the Compose file, and -p sets the project name.
Fill all three blanks to create a service with environment variables and restart policy.
services:
web:
image: nginx
environment:
- [1]=production
restart: [2]
ports:
- "80:80"
deploy:
replicas: [3]ENV=production sets an environment variable, restart: always ensures the container restarts on failure, and replicas: 3 runs three instances.