LogIn
I don't have account.

Practice docker Quizzes

Explore docker in depth with quizzes covering fundamentals to advanced concepts. DevBrainiac's structured quiz format helps you understand theory, apply logic and master problem-solving techniques. With continuous practice, you can track progress, fix mistakes and build strong command of docker.

Explore All docker Quizzes

Learn docker step by step with interactive quizzes designed for beginners and learners revising key concepts. Build a strong foundation with clear, structured practice in docker.
Question 1
What is the primary purpose of Docker?
1
To manage physical servers
2
To create virtual machines
3
To compile code faster
4
To containerize applications for portability and efficiency
Question 2
Which command is used to list all running Docker containers?
1
docker images
2
docker run
3
docker list
4
docker ps
Question 3
What is the default network driver used by Docker containers?
1
Bridge
2
Overlay
3
None
4
Host
Question 4
Which file is used to define multi-container Docker applications?
1
Containerfile
2
Docker.yaml
3
Dockerfile
4
docker-compose.yml
Question 5
What is the primary purpose of a Dockerfile?
1
To run database services
2
To store container logs
3
To create and build Docker images
4
To define system dependencies
Question 6
Which command is used to remove a stopped container?
1
docker remove <container_id>
2
docker stop <container_id>
3
docker rm <container_id>
4
docker rmi <container_id>
Question 7
How do you start an interactive shell inside a running container?
1
docker attach <container_id>
2
docker run -it <container_id>
3
docker shell <container_id>
4
docker exec -it <container_id> /bin/bash
Question 8
What is the difference between docker stop and docker kill?
1
docker kill can only be used on stopped containers
2
docker stop immediately kills the container, while docker kill sends a termination signal
3
They are identical commands
4
docker stop sends a graceful termination signal, while docker kill forcefully stops the container
Question 9
What is a Docker volume used for?
1
Automating deployments
2
Storing persistent data outside of containers
3
Managing container logs
4
Running multiple containers
Question 10
How do you remove an unused Docker image?
1
docker delete <image_id>
2
docker image prune
3
docker remove image <image_id>
4
docker rmi <image_id>
Question 11
What is a Docker image?
1
A template used to create Docker containers
2
A backup file for Docker
3
A running instance of a container
4
A virtual machine
Question 12
Which Dockerfile instruction sets the base image?
1
BASE
2
FROM
3
CMD
4
RUN
Question 13
What does the docker build command do?
1
Pushes an image to Docker Hub
2
Downloads an image
3
Creates a container image from a Dockerfile
4
Starts a new container
Question 14
What is Docker Hub?
1
A dashboard tool
2
A local storage for containers
3
A cloud-based repository for Docker images
4
An IDE for Docker
Question 15
What is the purpose of the EXPOSE instruction in a Dockerfile?
1
Documents the port the container listens on
2
Runs a command on a specific port
3
Opens a port in the Docker host firewall
4
Maps container ports to the host
Question 16
Which command is used to push a Docker image to Docker Hub?
1
docker export
2
docker push
3
docker save
4
docker upload
Question 17
What is the function of CMD in a Dockerfile?
1
Builds the image
2
Declares environment variables
3
Installs system packages
4
Specifies the command to run when a container starts
Question 18
What does docker logs <container> do?
1
Opens a shell inside the container
2
Deletes all logs
3
Lists running containers
4
Shows real-time logs from the container’s stdout and stderr
Question 19
Which of the following is true about Docker containers?
1
Each container includes a full operating system
2
Containers cannot run on Windows
3
Containers share the host OS kernel
4
Containers are slower than virtual machines
Question 20
What does docker-compose up do?
1
Builds and starts all services defined in docker-compose.yml
2
Installs Docker
3
Removes all containers
4
Pulls images from Docker Hub without starting them
Question 21
What happens if you run a container with a volume and the target folder inside the container already has data?
1
The host directory overwrites the container directory
2
Data is merged
3
The container's data is preserved
4
Docker throws an error
Question 22
Which networking mode allows Docker containers to share the host’s network stack?
1
bridge
2
host
3
overlay
4
macvlan
Question 23
What is the difference between COPY and ADD in a Dockerfile?
1
No difference
2
COPY is older than ADD
3
ADD is faster than COPY
4
ADD can fetch remote URLs and unpack archives
Question 24
Which of the following best describes a multi-stage Docker build?
1
Using one Dockerfile with multiple FROM instructions
2
Running multiple build commands at once
3
Using multiple containers in parallel
4
Combining multiple base images in one build
Question 25
You want to ensure a container restarts if it crashes. Which restart policy should you use?
1
unless-stopped
2
no
3
always
4
on-failure
Question 26
What’s the purpose of .dockerignore file?
1
It disables Dockerfile execution
2
It excludes files from image build context
3
It prevents files from being copied to the host
4
It hides logs
Question 27
What does the ENTRYPOINT instruction do differently from CMD?
1
It is overridden by Docker run arguments
2
It sets the main command that cannot be replaced by arguments
3
It runs only once
4
It cannot be changed
Question 28
How do you run a container in detached mode with an environment variable?
1
docker run -e -d ENV=production image
2
docker run -d ENV=production image
3
docker run --detach --env ENV=production image
4
docker start -e ENV=production image
Question 29
Which component is used for orchestrating multi-host Docker deployments?
1
Docker Network
2
Docker Machine
3
Docker Swarm
4
Docker Compose
Question 30
What does the --mount flag provide that -v (volume) does not?
1
Read-only support
2
Container restart on change
3
Clear syntax and extra options like consistency and caching
4
Named volumes