πŸ“Š Docker
Q. Which command is used to list all running services in Docker Compose?
  • (A) docker-compose ps
  • (B) docker-compose list
  • (C) docker-compose status
  • (D) docker-compose show
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker-compose ps

Explanation: The 'docker-compose ps' command lists all running services in a Docker Compose setup.

πŸ“Š Docker
Q. What is the purpose of 'volumes' in a Docker Compose file?
  • (A) To mount external files into containers
  • (B) To specify environment variables
  • (C) To define services
  • (D) To scale the services
πŸ’¬ Discuss
βœ… Correct Answer: (A) To mount external files into containers

Explanation: 'Volumes' are used in Docker Compose to mount external files or directories into containers.

πŸ“Š Docker
Q. Which of the following is NOT a valid service type in Docker Compose?
  • (A) Build
  • (B) Run
  • (C) Network
  • (D) Volume
πŸ’¬ Discuss
βœ… Correct Answer: (B) Run

Explanation: The 'run' service type is not a valid service type in Docker Compose.

πŸ“Š Docker
Q. How do you define the network settings for a service in Docker Compose?
  • (A) Using the 'networks' key
  • (B) Using the 'link' key
  • (C) Using the 'connections' key
  • (D) Using the 'network' key
πŸ’¬ Discuss
βœ… Correct Answer: (A) Using the 'networks' key

Explanation: In Docker Compose, the 'networks' key is used to define network settings for a service.

πŸ“Š Docker
Q. What is the default network mode for services in Docker Compose?
  • (A) bridge
  • (B) host
  • (C) none
  • (D) overlay
πŸ’¬ Discuss
βœ… Correct Answer: (A) bridge

Explanation: By default, Docker Compose uses the 'bridge' network mode for services.

πŸ“Š Docker
Q. Which of the following commands is used to execute a command inside a running Docker Compose container?
  • (A) docker-compose exec
  • (B) docker exec
  • (C) docker-compose run
  • (D) docker-compose command
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker-compose exec

Explanation: The 'docker-compose exec' command is used to execute commands inside a running Docker Compose container.

πŸ“Š Docker
Q. How do you configure a custom Docker Compose file name?
  • (A) Using the '--file' flag
  • (B) Using the '--config' flag
  • (C) Using the '--name' flag
  • (D) Using the '--compose' flag
πŸ’¬ Discuss
βœ… Correct Answer: (A) Using the '--file' flag

Explanation: You can configure a custom Docker Compose file name using the '--file' flag.

πŸ“Š Docker
Q. Which command is used to check the status of all services in Docker Compose?
  • (A) docker-compose status
  • (B) docker-compose show
  • (C) docker-compose ps
  • (D) docker-compose check
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker-compose ps

Explanation: The 'docker-compose ps' command shows the status of all services in a Docker Compose setup.

πŸ“Š Docker
Q. What does the 'docker-compose build' command do?
  • (A) Rebuilds the services defined in the Compose file
  • (B) Starts the services
  • (C) Shows the service status
  • (D) Scales the services
πŸ’¬ Discuss
βœ… Correct Answer: (A) Rebuilds the services defined in the Compose file

Explanation: The 'docker-compose build' command rebuilds the services defined in the Compose file.

πŸ“Š Docker
Q. Which command removes stopped containers, networks, and volumes created by Docker Compose?
  • (A) docker-compose prune
  • (B) docker-compose clean
  • (C) docker-compose down --volumes
  • (D) docker-compose destroy
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker-compose down --volumes

Explanation: The 'docker-compose down --volumes' command removes stopped containers, networks, and volumes created by Docker Compose.