11.) How do you specify environment variables in a Docker Compose file?
A) Using the env key
B) Using the variables key
C) Using the environment key
D) Using the config key
12.) Which command updates a running service in Docker Compose?
A) docker-compose redeploy
B) docker-compose update
C) docker-compose restart
D) docker-compose up
13.) How can you scale a service using Docker Compose?
A) By adding replicas in docker-compose.yml
B) Using the docker-compose scale command
C) Using the –replicas flag with docker-compose up
D) Both A and B
14.) Which key in the docker-compose.yml file is used to specify dependencies between services?
A) depends_on
B) links
C) volumes
D) networks
15.) How do you override the default docker-compose.yml file?
A) By renaming the file
B) By creating a docker-override.yml file
C) Using the -f flag with docker-compose commands
D) Using the –override flag
16.) How do you define custom networks in Docker Compose?
A) Under the networks key in docker-compose.yml
B) Using the docker network create command
C) By defining them in the container
D) Automatically generated by Compose
17.) What is the purpose of the restart key in Docker Compose?
A) To automatically rebuild the container
B) To define the restart policy for containers
C) To enable scaling of services
D) To restart the Docker service
18.) Which command lists the logs of all services in Docker Compose?
A) docker-compose logs
B) docker-compose show
C) docker-compose status
D) docker-compose events
19.) How do you remove orphaned containers created by Docker Compose?
A) docker-compose clean
B) docker-compose prune
C) docker-compose down –remove-orphans
D) docker-compose rm -orphans
20.) How do you build all services defined in a Compose file?
A) docker-compose create
B) docker-compose build
C) docker-compose compile
D) docker-compose prepare
Related