Docker Certified Associate Exam Practice Test

The Docker Certified Associate (DCA) certification validates your skills as an IT professional using Docker. Below are 25 multiple-choice practice questions that will help you prepare for the DCA exam. Each question comes with an answer and a brief explanation to enhance your understanding.

1. Which Docker command is used to create a new container?

A) docker create
B) docker init
C) docker run
D) docker start

Answer:

C) docker run

Explanation:

The docker run command is used to create a new container from an image and start it.

2. What does the -p flag do in the docker run command?

A) Publishes a container’s port to the host
B) Sets the priority of the container
C) Pauses the container
D) Displays the process running in the container

Answer:

A) Publishes a container’s port to the host

Explanation:

The -p flag in the docker run command is used to publish a container’s port to the host, allowing external access.

3. What is the primary purpose of Docker Compose?

A) To build Docker images
B) To define and run multi-container Docker applications
C) To manage Docker volumes
D) To monitor Docker containers

Answer:

B) To define and run multi-container Docker applications

Explanation:

Docker Compose is used primarily to define and run multi-container Docker applications, specifying services, networks, and volumes in a docker-compose.yml file.

4. Which of the following is a storage driver in Docker?

A) overlay2
B) bridge
C) host
D) macvlan

Answer:

A) overlay2

Explanation:

overlay2 is a storage driver used by Docker to manage container images and the container layer on the host.

5. Which command is used to remove Docker images?

A) docker rmi
B) docker remove
C) docker delete
D) docker del

Answer:

A) docker rmi

Explanation:

The docker rmi command is used to remove one or more Docker images from the host machine.

6. Which Docker network type provides complete isolation for containers?

A) Bridge
B) Host
C) None
D) Overlay

Answer:

C) None

Explanation:

The none network provides complete isolation for containers, with no external network access.

7. How do you connect a Docker container to a specific network?

A) Using docker network connect
B) Using docker network attach
C) Using docker network link
D) Using docker network bind

Answer:

A) docker network connect

Explanation:

The docker network connect command is used to connect a running container to a specific network.

8. Which of the following is true about Docker Bridge Network?

A) Containers on different hosts can communicate directly
B) Containers on the same host in different Bridge Networks can communicate directly
C) Containers on the same Bridge Network can communicate using IP addresses
D) Containers cannot communicate with each other on a Bridge Network

Answer:

C) Containers on the same Bridge Network can communicate using IP addresses

Explanation:

In a Docker Bridge Network, containers on the same network can communicate using IP addresses, but additional configuration is required for communication between different Bridge Networks or hosts.

9. What is the default network mode for a Docker container?

A) None
B) Host
C) Bridge
D) Overlay

Answer:

C) Bridge

Explanation:

By default, Docker containers are created using the Bridge network mode.

10. How can you restrict the traffic between containers on the same Docker network?

A) Using network policies
B) Using IPTables
C) Using Docker Swarm
D) It is not possible

Answer:

A) Using network policies

Explanation:

Network policies in Docker can be used to control and restrict the traffic between containers on the same network.

11. What is the purpose of Docker Volumes?

A) To store temporary data
B) To persist data generated by and used by Docker containers
C) To store Docker images
D) To backup Docker containers

Answer:

B) To persist data generated by and used by Docker containers

Explanation:

Docker Volumes are used to persist data generated by and used by Docker containers, ensuring that the data outlives the container.

12. Which Docker command is used to list all the volumes?

A) docker volumes ls
B) docker volume list
C) docker volume ls
D) docker ls volume

Answer:

C) docker volume ls

Explanation:

The docker volume ls command is used to list all Docker volumes on the host machine.

13. How can you backup the data of a Docker container?

A) Using docker cp command
B) Using docker backup command
C) Using docker save command
D) Using docker export command

Answer:

A) Using docker cp command

Explanation:

The docker cp command can be used to copy files or directories between a container and the local filesystem, which can be helpful for backing up data.

14. What is the advantage of using Docker named volumes over bind mounts?

A) Named volumes are stored externally
B) Named volumes support relative paths
C) Named volumes are easier to backup
D) Named volumes are easier to manage

Answer:

D) Named volumes are easier to manage

Explanation:

Named volumes are managed by Docker and are easier to manage, backup, and migrate compared to bind mounts.

15. Which Docker command is used to inspect the details of a volume?

A) docker volume inspect
B) docker volume info
C) docker volume details
D) docker inspect volume

Answer:

A) docker volume inspect

Explanation:

The docker volume inspect command is used to display detailed information about one or more volumes.

16. What is the purpose of Docker Swarm?

A) To build Docker images
B) To define multi-container Docker applications
C) To orchestrate Docker services across multiple Docker hosts
D) To monitor Docker containers

Answer:

C) To orchestrate Docker services across multiple Docker hosts

Explanation:

Docker Swarm is an orchestration tool used to deploy, scale, and manage Docker services across multiple Docker hosts.

17. How can you scale a Docker service in Docker Swarm?

A) Using docker service update –replicas
B) Using docker service scale
C) Using docker swarm scale
D) Both A and B

Answer:

D) Both A and B

Explanation:

You can scale a Docker service in Docker Swarm using either the docker service update –replicas command or the docker service scale command.

18. What is the role of a manager node in Docker Swarm?

A) To only schedule services
B) To only execute services
C) To schedule and execute services
D) To monitor worker nodes

Answer:

C) To schedule and execute services

Explanation:

In Docker Swarm, manager nodes are responsible for scheduling services and can also execute services, unlike worker nodes, which only execute services.

19. How do you deploy a stack in Docker Swarm?

A) Using docker stack deploy
B) Using docker swarm deploy
C) Using docker service deploy
D) Using docker deploy stack

Answer:

A) docker stack deploy

Explanation:

The docker stack deploy command is used to deploy a new stack or update an existing stack based on the services defined in a docker-compose.yml file.

20. Which of the following is a valid Docker Swarm service update strategy?

A) Recreate
B) Rolling
C) Blue-Green
D) Canary

Answer:

B) Rolling

Explanation:

Docker Swarm supports the Rolling update strategy to update services progressively without downtime.

21. How can you enable Docker Content Trust (DCT)?

A) By setting the DOCKER_CONTENT_TRUST environment variable to 1
B) By using the –enable-dct flag with docker command
C) By configuring Docker daemon JSON file
D) By using Docker Security Scanning

Answer:

A) By setting the DOCKER_CONTENT_TRUST environment variable to 1

Explanation:

Docker Content Trust (DCT) can be enabled by setting the DOCKER_CONTENT_TRUST environment variable to 1.

22. Which Docker command is used to view the security scan results of an image?

A) docker scan
B) docker security
C) docker inspect –security
D) docker image scan

Answer:

A) docker scan

Explanation:

The docker scan command is used to view the security scan results of a Docker image.

23. How can you sign a Docker image?

A) Using Docker Content Trust (DCT)
B) Using Docker Security Scanning
C) Using Docker Secrets
D) By configuring Docker daemon JSON file

Answer:

A) Using Docker Content Trust (DCT)

Explanation:

Docker images can be signed using Docker Content Trust (DCT) to ensure image integrity and publisher authenticity.

24. What is the purpose of Docker Secrets?

A) To scan Docker images for vulnerabilities
B) To manage sensitive data such as passwords and API keys
C) To sign Docker images
D) To encrypt Docker networks

Answer:

B) To manage sensitive data such as passwords and API keys

Explanation:

Docker Secrets is a feature designed to manage sensitive data such as passwords, API keys, and other secrets in a secure way.

25. How can you limit the system resources used by a Docker container?

A) Using –cpus and –memory flags with docker run command
B) Using Docker Compose
C) Using Docker Swarm
D) By configuring Docker daemon JSON file

Answer:

A) Using –cpus and –memory flags with docker run command

Explanation:

System resources like CPU and memory used by a Docker container can be limited using the –cpus and –memory flags with the docker run command.


This practice test is intended to help you prepare for the Docker Certified Associate exam. Reviewing these questions and understanding the explanations will deepen your knowledge and readiness for the actual test. We wish you all the best in your certification journey!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top