Docker images are a core concept of Docker, representing the blueprint for containers. They contain the application, its dependencies, and all necessary configurations to run consistently across environments. Mastering Docker images is crucial for understanding containerization.
These top MCQs test your knowledge about building, managing, and optimizing Docker images. Understanding these topics will help you confidently answer interview questions related to Docker images and their practical usage.
1.) What is a Docker image?
A) A virtual machine template
B) A tool for monitoring containers
C) A configuration file for Docker containers
D) A lightweight, standalone executable package containing application code and dependencies
2.) What is the base image in Docker?
A) An empty Docker container
B) The first layer of any Docker image
C) A custom-built image from scratch
D) The default image used for all containers
3.) What file is used to build a Docker image?
A) Dockerfile
B) ImageConfig
C) DockerConfig.json
D) ImageBuilder
4.) Which command is used to build a Docker image from a Dockerfile?
A) docker run
B) docker build
C) docker create
D) docker image
5.) Where are Docker images stored locally by default?
A) /var/docker/images
B) /usr/lib/docker
C) /var/lib/docker
D) /etc/docker/images
6.) What is a multi-stage build in Docker?
A) Building multiple containers simultaneously
B) Using multiple base images in a single Dockerfile
C) Optimizing Docker images by using intermediate stages to reduce image size
D) Running multiple containers in parallel
7.) How do you push a Docker image to Docker Hub?
A) docker push <image>
B) docker upload <image>
C) docker save <image>
D) docker deploy <image>
8.) Which command lists all the locally available Docker images?
A) docker ps
B) docker inspect
C) docker ls
D) docker images
9.) How do you tag a Docker image during the build process?
A) By using the -name flag
B) By using the -t flag
C) By using the –image flag
D) By renaming the Dockerfile
10.) What does the docker pull command do?
A) Creates a new Docker image
B) Deletes a Docker image
C) Downloads a Docker image from a registry
D) Runs a container from a Docker image
Related