Login Account

Docker Questions

V
Vikas Vimal (Vikki)
Score: 🔥 175
Beginner
Took 2 months
Software Tool
Docker
86%
Questions Attempted
15 / 15
Correct Answers
13
Incorrect Answers
2
Points Earned
🔥 13

Question 1

If you launch a container with '--network none' and later need to give it network access, what should you do?

Explanation:

You can dynamically add or remove a container from a network using 'docker network connect' and 'docker network disconnect' even after the container is created.

Question 2

What is a Docker image?

Explanation:

A Docker image serves as a blueprint containing the application code, libraries, dependencies, and configurations needed to create a Docker container.

Question 3

What's the purpose of the -d flag when running a Docker container?

Explanation:

-d stands for 'detached'. When you use this flag, the container runs in the background, freeing up your terminal.

Question 4

When should you consider using the 'host' network mode for a Docker container?

Explanation:

The 'host' mode allows the container to directly access the host's network interfaces and observe all network traffic, making it suitable for network monitoring tools.

Question 5

What is the core functionality of Docker?

Explanation:

Docker specializes in creating lightweight, portable environments called containers. These containers encapsulate applications and their dependencies, making them runnable on various systems without compatibility issues.

Question 6

What is the primary purpose of Docker?

Explanation:

Docker's core function is to package applications and their dependencies into containers, creating consistent and isolated environments for development, testing, and deployment.

Question 7

What is the primary purpose of Docker containers in software development?

Explanation:

Docker containers encapsulate applications and their dependencies, providing a consistent and isolated environment across different systems. This isolation and portability enhance development, testing, and deployment workflows.

Question 8

Which command is used to download a Docker image from a registry?

Explanation:

The docker pull command retrieves an image from a registry, such as Docker Hub, and stores it locally for later use in creating containers.

Question 9

Which component of Docker's architecture is responsible for building and storing Docker images?

Explanation:

Docker Registries, like Docker Hub, act as repositories for Docker images. They allow developers to store and share pre-built images, simplifying application deployment.

Question 10

Which file format does Docker Compose use for defining application services?

Explanation:

Docker Compose relies on a YAML file named 'docker-compose.yml' to describe the services, networks, and volumes that make up your application. YAML's human-readable format makes it well-suited for this purpose.

Question 11

How do you list all running Docker containers?

Explanation:

The command 'docker ps' provides a list of all actively running containers on your system. The '-a' flag would show all containers, including stopped ones.

Question 12

Which command is used to create and start a Docker container?

Explanation:

The docker run command is a combined operation. It first creates a new container from a specified image and then starts that container.

Question 13

What does the '-d' flag do when running a Docker container?

Explanation:

The -d flag stands for 'detached.' It instructs Docker to run the container in the background, keeping your terminal session free.

Question 14

In a 'docker-compose.yml' file, what is the keyword used to define a service?

Explanation:

The 'service' keyword is the fundamental building block in a 'docker-compose.yml' file. Each service you define represents a container or a set of containers that work together.

Question 15

After stopping a container, you want to remove it completely. What command should you use?

Explanation:

docker rm is used to remove a container. Note: The container must be stopped before it can be removed.