Docker Basics MCQs with Answers and Explanations
Practice Docker Basics MCQs. from DevOps subject. with solved answers and explanations. updated syllabus-based questions.
Search MCQs, Papers, Topics
Question 1: What does `docker build` command do?
docker build reads the instructions in a Dockerfile and creates a Docker image layer by layer. The resulting image can then be run as a container or pushed to a registry.
Question 2: Which tool is used to define and manage multi-container Docker applications?
Docker Compose is a tool for defining and running multi-container Docker applications using a docker-compose.yml file. It simplifies orchestration of multiple interdependent services in development environments.
Question 3: In Docker, what command is used to list all running containers?
The docker ps command lists all currently running containers. Adding the -a flag shows all containers including stopped ones.
Question 4: What is a "container image" in Docker?
A Docker container image is a read-only template containing the application code, runtime, libraries, and dependencies. Running an image creates a container instance.
Question 5: What does the `docker-compose up` command do?
docker-compose up reads the docker-compose.yml file, builds images if needed, and starts all defined services as containers. It simplifies managing multi-container applications.
Question 6: What is the primary purpose of a Dockerfile?
A Dockerfile is a text file containing instructions to build a Docker image. It defines the base image, dependencies, configuration, and commands needed to run an application in a container.
Question 7: What is the main purpose of Docker containers in deployment workflows?
Docker containers help package applications and dependencies consistently, making them portable across environments.
Question 8: In Docker, what is an image?
A Docker image is a read-only template used to create containers.
Question 9: Which statement about containers is correct?
Containers are lightweight and share the host OS kernel, making them more efficient than full virtual machines in many cases.
Showing 1 to 9 of 9 results