Docker Compose MCQs with answers Page - 2

You will find multiple-choice questions (MCQs) related to #Docker Compose here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 828.03K Points
Coach

Q. Which key is used to build an image from a Dockerfile in docker-compose.yml?

  • (A) image
  • (B) dockerfile
  • (C) build
  • (D) create

A

Admin • 828.03K Points
Coach

Q. Which command runs services in detached mode?

  • (A) docker-compose start -d
  • (B) docker-compose up -d
  • (C) docker-compose run --detach
  • (D) docker-compose background

A

Admin • 828.03K Points
Coach

Q. What format does Docker Compose use for its configuration files?

  • (A) JSON
  • (B) XML
  • (C) YAML
  • (D) INI

A

Admin • 828.03K Points
Coach

Q. What command updates containers when changes are made to the Compose file?

  • (A) docker-compose build
  • (B) docker-compose restart
  • (C) docker-compose up --force-recreate
  • (D) docker-compose refresh

A

Admin • 828.03K Points
Coach

Q. Which command builds or rebuilds services defined in a Compose file?

  • (A) docker-compose make
  • (B) docker-compose build
  • (C) docker-compose update
  • (D) docker-compose refresh

A

Admin • 828.03K Points
Coach

Q. Which section in docker-compose.yml is used to define persistent storage?

  • (A) storage
  • (B) volume
  • (C) volumes
  • (D) data

A

Admin • 828.03K Points
Coach

Q. What key in docker-compose.yml defines network configurations?

  • (A) networking
  • (B) networks
  • (C) connections
  • (D) links

A

Admin • 828.03K Points
Coach

Q. Which command scales a specific service to multiple instances?

  • (A) docker-compose replicate
  • (B) docker-compose up --scale
  • (C) docker-compose multiply
  • (D) docker-compose expand

A

Admin • 828.03K Points
Coach

Q. What is the correct syntax to map ports in docker-compose.yml?

  • (A) port: '80:80'
  • (B) map_ports: '80:80'
  • (C) ports: - '80:80'
  • (D) expose: 80

A

Admin • 828.03K Points
Coach

Q. Which Docker Compose command pauses all running containers of a service?

  • (A) docker-compose pause
  • (B) docker-compose stop
  • (C) docker-compose halt
  • (D) docker-compose kill
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More