Last Updated On
Welcome to the Docker Quiz! This blog post features 25 multiple-choice questions that explore basic concepts of Docker.
1. What is Docker?
a) A Hypervisor
b) An Operating System
c) A Virtual Machine
d) A Containerization platform
Answer 1
d) A Containerization platform
Docker is a containerization platform that allows developers to package and distribute applications and their dependencies in isolated containers.
2. Which of the following is the core component of Docker?
a) Docker CLI
b) Docker Engine
c) Docker Server
d) Docker Hypervisor
Answer 2
b) Docker Engine
Docker Engine is the core component of Docker. It is responsible for creating, managing, and running Docker containers.
3. Which command is used to check the version of Docker?
a) docker details
b) docker info
c) docker version
d) docker –version
Answer 3
d) docker –version
4. What is a Docker Container?
a) A network service
b) A lightweight executable package
c) An Operating System kernel
d) A Virtual Machine
Answer 4
b) A lightweight executable package
A Docker container is a lightweight, standalone executable package containing everything needed to run a piece of software, including code, runtime, libraries, and system tools.
5. Which command creates and starts a new container?
a) docker create
b) docker start
c) docker run
d) docker build
Answer 5
c) docker run
The command docker run creates and starts a new container from a specified Docker image. It combines the functions of the docker create and docker start commands into a single step, allowing the user to instantiate and execute a container immediately.
6. Which of the following command you will use to list your containers?
a) docker list
b) docker show
c) docker ps
d) docker display
Answer 6
c) docker ps
The docker ps command lists all running Docker containers, along with various details like container ID, image name, creation time, and so on.
7. Which of the following statement is correct?
a) To remove a container, you first need to stop it
b) You can directly remove a container, without stopping it.
Answer 7
a) To remove a container, you first need to stop it
To remove a container, you first need to stop it. Once it has stopped, you can remove it.
8. How do you stop a running Docker container?
a) docker pause
b) docker terminate
c) docker end
d) docker stop
Answer 8
d) docker stop
The docker stop command stops a running container, gracefully terminating its processes.
9. What is a Docker Image?
a) A running container
b) A snapshot of an application and its dependencies
c) A configuration file
d) A virtual hard drive
Answer 9
b) A snapshot of an application and its dependencies
A Docker Image contains all the necessary components to run an application, including code, libraries, dependencies, and runtime.
10. Which command is used to create a new Docker image?
a) docker build
b) docker pull
c) docker run
d) docker commit
Answer 10
a) docker build
The docker build command is used to build a new image from a Dockerfile and a “context”. The context is the set of files in a specified directory or URLs that the image is built from.
11. Which command pulls an image from Docker Hub?
Choose one option
a) docker get
b) docker fetch
c) docker pull
d) docker download
Answer 11
c) docker pull
The docker pull command is used to pull or download a Docker image from a registry like Docker Hub.
12. How can you remove a Docker image?
Choose one option
a) docker remove
b) docker delete
c) docker rm
d) docker rmi
Answer 12
d) docker rmi
The docker rmi command is used to remove a Docker image from the system.
13. How can you run a command inside an existing Docker container?
Choose one option
a) docker exec
b) docker attach
c) docker run
d) docker enter
Answer 13
a) docker exec
The docker exec command allows you to run commands inside an existing container. For example, docker exec -it container_id /bin/bash would open a bash shell inside the container with ID container_id.
14. What is Docker Compose?
Choose one option
a) A scripting language for Docker
b) A continuous integration tool for Docker
c) A tool for defining and running multi-container Docker applications
d) A Docker CLI plugin
Answer 14
c) A tool for defining and running multi-container Docker applications
Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you define the services, networks, and volumes in a single docker-compose.yml file and then use docker-compose up to start the entire application stack.
15. What is the difference between a Docker Container and a Virtual Machine?
Choose one option
a) Containers are slower than VMs
b) VMs run on hardware, while containers do not
c) Containers share the host OS kernel, while VMs have their own kernel
d) Containers are heavier than VMs
Answer 15
c) Containers share the host OS kernel, while VMs have their own kernel
Containers share the host OS kernel, whereas VMs have their own OS kernel, making containers more lightweight and efficient.
16. Which of the following is the default registry used by Docker?
Choose one option
a) Kubernetes Hub
b) Container Store
c) Docker Hub
d) Image Hub
Answer 16
c) Docker Hub
Docker Hub is the default public registry where Docker images are stored and shared. You can pull and push images from and to Docker Hub.
17. What are the key components of Docker architecture?
Choose one option
a) Docker Manager, Docker Processor, Docker Configurator
b) Docker Master, Docker Node, Docker Registry
c) Docker Engine, Docker CLI, Docker Daemon
d) Docker Kernel, Docker Service, Docker Network
Answer 17
c) Docker Engine, Docker CLI, Docker Daemon
18. What is the role of the Docker Daemon?
a) It stores operating system data
b) It manages containers, images, and networks
c) It interacts with the user interface
d) It only handles logs
Answer 18
b) It manages containers, images, and networks
19. What is a Docker Registry?
a) A network router
b) A local storage system
c) A virtual machine host
d) A repository for storing and sharing Docker images
Answer 19
d) A repository for storing and sharing Docker images
A Docker Registry is a storage system where you can store, share, and retrieve Docker images. Docker Hub is a popular example.
20. What is the primary purpose of the Docker Engine?
Choose one option
a) To provide a graphical visualization of containers
b) To build and run containers
c) To manage databases inside containers
d) To interface with Kubernetes
Answer 20
b) To build and run containers
21. Which of the following commands logs you into Docker Hub from the CLI?
a) docker login
b) docker auth
c) docker sign-in
d) docker connect
Answer 21
a) docker login
The docker login command allows users to log into Docker Hub or any other Docker registry from the command-line interface.
22. What does the -d flag do in the docker run command?
a) Deletes the container
b) Displays detailed information
c) Detaches the container (runs in the background)
d) Downloads the latest image
Answer 22
c) Detaches the container (runs in the background)
23. How do you specify a Dockerfile other than the default “Dockerfile” during the build process?
a) Use –filename option
b) Use –source option
c) Use –file option
d) Use –dockerfile option
Answer 23
c) Use –file option
The –file or -f option allows users to specify a different Dockerfile than the default one. For example, docker build –f MyDockerfile .
24. Which CLI command shows detailed information about a container?
a) docker inspect
b) docker show
c) docker details
d) docker info
Answer 24
a) docker inspect
docker inspect provides detailed information about containers, including network configurations, status, and metadata.
25. Once the container has stopped, which of the following command you will use to remove a container?
a) Docker remove
b) Docker Destroy
c) Docker rm
d) Docker del
Answer 25
c) Docker rm
When the container has stopped, use the docker rm command to remove it.
We would love to hear from you! Please leave your comments and share your scores in the section below