Docker MCQs with answers Page - 8

Here, you will find a collection of MCQ questions on Docker. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

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

A

Admin • 831.35K Points
Coach

Q. Which command is used to build a Docker image?

  • (A) docker build
  • (B) docker create
  • (C) docker run
  • (D) docker image build

A

Admin • 831.35K Points
Coach

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

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ