Dockerfile MCQs with answers Page - 6

You will find multiple-choice questions (MCQs) related to #Dockerfile 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 • 802.91K Points
Coach

Q. What is the best practice when copying large files in a Dockerfile?

  • (A) Use multiple `COPY` steps
  • (B) Combine into a single `COPY` step
  • (C) Use `RUN` instead
  • (D) Use `LABEL`

A

Admin • 802.91K Points
Coach

Q. How do you specify a maintainer for a Docker image?

  • (A) LABEL maintainer="email"
  • (B) ENV MAINTAINER
  • (C) MAINTAINER
  • (D) USER

A

Admin • 802.91K Points
Coach

Q. Which instruction sets the user to execute subsequent commands?

  • (A) RUN AS
  • (B) USER
  • (C) SETUSER
  • (D) LOGIN

A

Admin • 802.91K Points
Coach

Q. What is multi-stage build in Dockerfile?

  • (A) Builds images in multiple parts for debugging
  • (B) Using `RUN` multiple times
  • (C) Using multiple `FROM` statements to reduce image size
  • (D) A way to run multiple containers

A

Admin • 802.91K Points
Coach

Q. What is the effect of using `ENTRYPOINT` with `CMD`?

  • (A) `CMD` replaces `ENTRYPOINT`
  • (B) `CMD` provides arguments to `ENTRYPOINT`
  • (C) `ENTRYPOINT` overrides `CMD`
  • (D) Both are ignored

A

Admin • 802.91K Points
Coach

Q. Where should the Dockerfile be placed?

  • (A) Anywhere in the system
  • (B) Inside /usr/local
  • (C) Root of the build context
  • (D) Docker directory

A

Admin • 802.91K Points
Coach

Q. What is the extension of a Dockerfile?

  • (A) .docker
  • (B) .df
  • (C) .dock
  • (D) No extension

A

Admin • 802.91K Points
Coach

Q. Which instruction can download files from a remote URL?

  • (A) COPY
  • (B) GET
  • (C) ADD
  • (D) RUN download

A

Admin • 802.91K Points
Coach

Q. Which instruction in Dockerfile is deprecated?

  • (A) ENV
  • (B) EXPOSE
  • (C) MAINTAINER
  • (D) COPY

A

Admin • 802.91K Points
Coach

Q. What command builds an image using a Dockerfile?

  • (A) docker run
  • (B) docker image create
  • (C) docker build
  • (D) docker make
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