Docker MCQs with answers Page - 2

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 • 828.03K Points
Coach

Q. Which file is used to define a Docker image?

  • (A) Dockerfile
  • (B) docker-compose.yml
  • (C) docker-config.json
  • (D) docker-image.yml

A

Admin • 828.03K Points
Coach

Q. What is the default network driver in Docker?

  • (A) host
  • (B) bridge
  • (C) overlay
  • (D) macvlan

A

Admin • 828.03K Points
Coach

Q. Which command is used to stop a running Docker container?

  • (A) docker stop
  • (B) docker kill
  • (C) docker pause
  • (D) docker halt

A

Admin • 828.03K Points
Coach

Q. What is Docker Hub?

  • (A) A local Docker registry
  • (B) A cloud-based repository for Docker images
  • (C) A Docker networking tool
  • (D) A Docker monitoring service

A

Admin • 828.03K Points
Coach

Q. Which command is used to remove a Docker container?

  • (A) docker rm
  • (B) docker delete
  • (C) docker remove
  • (D) docker erase

A

Admin • 828.03K Points
Coach

Q. What is the purpose of the EXPOSE instruction in a Dockerfile?

  • (A) To open a port on the host machine
  • (B) To document which ports are used by the container
  • (C) To publish a container's port to the host
  • (D) To map a container's port to a specific host port

A

Admin • 828.03K Points
Coach

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

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

A

Admin • 828.03K Points
Coach

Q. What is the purpose of the CMD instruction in a Dockerfile?

  • (A) To specify the base image
  • (B) To define the default command to run in the container
  • (C) To set environment variables
  • (D) To copy files into the container

A

Admin • 828.03K Points
Coach

Q. Which command is used to view logs of a Docker container?

  • (A) docker logs
  • (B) docker view
  • (C) docker inspect
  • (D) docker history

A

Admin • 828.03K Points
Coach

Q. What is the purpose of the ENTRYPOINT instruction in a Dockerfile?

  • (A) To specify the base image
  • (B) To define the default command to run in the container
  • (C) To set environment variables
  • (D) To copy files into the container

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