Learn. Practice. Feel prepared.
Docker Objective Questions and Answers
This Docker quiz contains carefully curated objective questions with correct answers and clear explanations. It is designed for developers, DevOps engineers, and interview preparation, covering containerization fundamentals and best practices.
Practice Docker MCQs with Detailed Explanations
Answer at least 12 questions to submit and verify answers.
1 What is Docker primarily used for? Easy
Correct answer:
Containerizing applications
Docker is used to containerize applications so they can run consistently across different environments.
2 Which Docker component is responsible for building images? Easy
Correct answer:
Dockerfile
A Dockerfile contains instructions used to build a Docker image.
3 Which command is used to check the Docker version? Easy
Correct answer:
docker --version
The docker --version command displays the installed Docker version.
4 What is a Docker image? Easy
Correct answer:
A blueprint for containers
A Docker image is a read-only template used to create containers.
5 What is a Docker container? Easy
Correct answer:
A running instance of an image
A container is a runnable instance of a Docker image.
6 Which command is used to list running containers? Easy
Correct answer:
docker ps
docker ps lists all currently running containers.
7 Which command stops a running container? Easy
Correct answer:
docker stop
docker stop gracefully stops a running container.
8 Which file defines multi-container Docker applications? Medium
Correct answer:
docker-compose.yml
docker-compose.yml is used to define and manage multi-container applications.
9 Which Docker command builds an image from a Dockerfile? Easy
Correct answer:
docker build
docker build creates a Docker image using instructions from a Dockerfile.
10 Which instruction specifies the base image in a Dockerfile? Easy
Correct answer:
FROM
FROM sets the base image for building a new Docker image.
11 Which instruction runs commands during image build time? Easy
Correct answer:
RUN
RUN executes commands while building the Docker image.
12 Which instruction defines the default command for a container? Medium
Correct answer:
CMD
CMD specifies the default command executed when a container starts.
13 Which instruction copies files from host to image? Easy
Correct answer:
ADD
ADD copies files and directories into the Docker image.
14 What is Docker Hub? Easy
Correct answer:
An image registry
Docker Hub is a public registry for storing and sharing Docker images.
15 Which command downloads an image from a registry? Easy
Correct answer:
docker pull
docker pull downloads an image from a container registry.