πŸ“Š Docker
Q. Which of the following is used to share a volume between services in Docker Compose?
  • (A) SharedVolumes
  • (B) volumes_from
  • (C) link
  • (D) external
πŸ’¬ Discuss
βœ… Correct Answer: (B) volumes_from

Explanation: The 'volumes_from' option is used to share a volume between services in Docker Compose.

πŸ“Š Docker
Q. Which command is used to run a one-off command in a new container in Docker Compose?
  • (A) docker-compose exec
  • (B) docker-compose run
  • (C) docker-compose start
  • (D) docker-compose init
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker-compose run

Explanation: The 'docker-compose run' command is used to run a one-off command in a new container.

πŸ“Š Docker
Q. How can you set a specific Docker Compose service to always restart on failure?
  • (A) restart: on-failure
  • (B) restart: always
  • (C) restart: on-crash
  • (D) restart: never
πŸ’¬ Discuss
βœ… Correct Answer: (A) restart: on-failure

Explanation: The 'restart: on-failure' option sets a service to always restart on failure in Docker Compose.

πŸ“Š Docker
Q. What is the purpose of the 'links' key in Docker Compose?
  • (A) To define dependencies between services
  • (B) To define network settings
  • (C) To set environment variables
  • (D) To scale services
πŸ’¬ Discuss
βœ… Correct Answer: (A) To define dependencies between services

Explanation: The 'links' key is used to define dependencies between services in Docker Compose.

πŸ“Š Docker
Q. Which command is used to view the current Docker Compose configuration?
  • (A) docker-compose config
  • (B) docker-compose view
  • (C) docker-compose show
  • (D) docker-compose status
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker-compose config

Explanation: The 'docker-compose config' command is used to view the current Docker Compose configuration.

πŸ“Š Docker
Q. How can you set Docker Compose to automatically remove containers after they stop?
  • (A) Using 'remove: true' in the Compose file
  • (B) Using 'docker-compose rm -f'
  • (C) Using 'docker-compose down --remove'
  • (D) Using 'restart: always' in the Compose file
πŸ’¬ Discuss
βœ… Correct Answer: (B) Using 'docker-compose rm -f'

Explanation: The 'docker-compose rm -f' command removes containers after they stop.

πŸ“Š Docker
Q. What is the primary purpose of Docker?
  • (A) To deploy applications
  • (B) To manage system configurations
  • (C) To automate software development
  • (D) To provide a containerized environment for applications
πŸ’¬ Discuss
βœ… Correct Answer: (D) To provide a containerized environment for applications

Explanation: Docker provides a containerized environment for deploying and running applications in isolated environments.

πŸ“Š Docker
Q. What is a Docker image?
  • (A) A running instance of a Docker container
  • (B) A blueprint used to create Docker containers
  • (C) A file containing Docker configuration settings
  • (D) A Docker registry
πŸ’¬ Discuss
βœ… Correct Answer: (B) A blueprint used to create Docker containers

Explanation: A Docker image is a blueprint used to create containers. It includes the application and its dependencies.

πŸ“Š Docker
Q. Which command is used to build a Docker image?
  • (A) docker build
  • (B) docker create
  • (C) docker run
  • (D) docker image build
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker build

Explanation: The 'docker build' command is used to build Docker images from a Dockerfile.

πŸ“Š Docker
Q. How do you list all Docker containers, including stopped ones?
  • (A) docker ps -a
  • (B) docker containers -a
  • (C) docker list containers
  • (D) docker ps -all
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker ps -a

Explanation: The 'docker ps -a' command lists all containers, including those that are stopped.