Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free Docker Certified Associate Exam DCA Exam Questions

Last updated: · 15 practice questions with answers and explanations

Page: 1 / 13 Total 191 questions

Want more questions? Get Premium Access.

Question 1

New Multiple answers

Topic: Domain 1: Orchestration

Skill tested: Converts a Compose deployment into a Swarm stack with replicated services and published ports.

A payments team currently starts its web tier and API with a Compose file on a single Docker host. They are moving to a Swarm with three managers and four workers. The deployment must keep three web tasks running, publish HTTPS on port 443 through the Swarm routing mesh, and keep both services on the same overlay network. The Compose file uses a feature that is not supported by `docker stack deploy`; the team has removed that unsupported setting and confirmed the remaining file uses supported stack syntax. Which actions are appropriate to deploy and then scale the web tier? Select TWO.

Correct Answer: B. Set `deploy.replicas: 3` and port target/published values in the Compose file, then run `docker stack deploy -c compose.yml payments`.; D. Run `docker stack deploy -c compose.yml payments`, then run `docker service scale payments_web=5`.
Explanation:

A stack deployment creates Swarm services from supported Compose stack configuration, including replica count, overlay networking, and published ports. `docker service scale` changes the desired replica count of the deployed service. `docker compose up` manages standalone containers rather than creating Swarm services, so it does not provide Swarm scheduling. Individually launched containers are not stack tasks. Host networking bypasses the routing mesh; it does not make the ingress-published port available through the routing mesh.

Question 2

New Single answer

Topic: Domain 1: Orchestration

Skill tested: Evaluates manager quorum and recovery choices after losing Swarm managers.

A production Swarm has five managers and six workers. A network partition isolates two managers from the other three, while the worker nodes remain able to reach application clients. Administrators can still inspect workloads on the isolated side but cannot change service definitions there. The business requires new scheduling decisions and service updates to proceed safely on the majority side. Which explanation and action best fit this condition?

Correct Answer: B. The majority side retains manager quorum and can make cluster changes; keep the isolated managers from accepting competing control-plane changes until connectivity is restored.
Explanation:

A five-manager Swarm requires a majority of managers - three - to maintain quorum for consensus-backed control-plane operations. The three connected managers can continue making changes; the two isolated managers cannot form an independent majority. Workers execute tasks but do not vote in manager quorum. Restarting all majority managers risks disrupting the functioning control plane, and stopping workers does not increase the number of manager votes. Preventing conflicting administration on the minority side avoids treating its stale view as authoritative.

Question 3

New Multiple answers

Topic: Domain 1: Orchestration

Skill tested: Uses node labels and placement constraints to schedule tasks on eligible Swarm nodes.

A media company runs a Swarm service that requires a locally attached NVMe cache. Only two worker nodes have that hardware, and operators have already verified and labeled those nodes with `cache=nvme`. The service should run four replicas for availability, but no task may be scheduled on nodes without the cache. The manager nodes must remain dedicated to control-plane duties. Which TWO configuration choices meet these requirements? Select TWO.

Correct Answer: C. Set the service mode to replicated with four replicas and apply the node-label constraint.; D. Set the service placement constraint to `node.labels.cache == nvme`.
Explanation:

A placement constraint is a hard eligibility rule: tasks are assigned only to nodes whose label matches `cache=nvme`. Replicated mode with four desired tasks expresses the required count, although the Swarm can leave tasks pending if there are insufficient eligible resources or nodes. Global mode creates one task on each eligible node and does not express four replicas. A placement preference is best-effort rather than restrictive, while labeling every node would falsely declare that all nodes have the required hardware.

Question 4

New Single answer

Topic: Domain 1: Orchestration

Skill tested: Interprets service inspection and task state to distinguish desired replicas from running tasks.

During a release, an administrator runs `docker service inspect` and sees `Mode.Replicated.Replicas` set to 4. A subsequent `docker service ps` shows two tasks running, one task rejected because its node lacks available memory, and one task pending. The service is attached to the correct overlay network and its image is available on all nodes. The team asks whether the service is healthy merely because inspection reports four replicas. What is the best interpretation and next operational step?

Correct Answer: D. The desired state is four tasks, but only two are currently running; investigate node capacity and scheduling before treating the deployment as converged.
Explanation:

The replicated count in service inspection describes the desired number of tasks, not proof that all tasks have reached the running state. `docker service ps` exposes individual task states and the rejection reason. Here, memory pressure is directly reported, so capacity and placement need investigation; changing the port or network is not supported by the evidence. A service can remain below its desired replica count while the scheduler retries or waits for suitable resources.

Question 5

New Single answer

Topic: Domain 2: Image Creation, Management, and Registry

Skill tested: Improves Dockerfile build efficiency through layer reuse and build-context control.

A development group builds a large application image from a Dockerfile. The dependency manifest changes infrequently, but source files change on every commit. Their current Dockerfile copies the entire source tree before installing dependencies, so every code edit invalidates the dependency-install layer. The build context also contains local test output and version-control metadata. The team wants faster repeat builds without changing the resulting runtime contents. Which change is most appropriate?

Correct Answer: A. Copy the dependency manifests first, install dependencies, then copy the frequently changing source; exclude irrelevant files with `.dockerignore`.
Explanation:

Docker reuses a layer when its instruction and relevant inputs have not changed. Copying stable dependency manifests and installing dependencies before copying frequently modified source preserves the expensive dependency layer across source-only changes. A `.dockerignore` file prevents unnecessary files from entering the build context and affecting cache or transfer size. Copying the whole tree early invalidates subsequent layers, `ADD` does not create special cache behavior, and squashing does not solve the cache invalidation problem.

Question 6

New Multiple answers

Topic: Domain 2: Image Creation, Management, and Registry

Skill tested: Tags, pushes, and verifies images in a private Docker registry.

A release pipeline builds `billing:2.4` locally. The company registry is reachable at `registry.example.com:5000`, and repository access requires an authenticated login. The release must be published under `registry.example.com:5000/finance/billing:2.4`; the existing local image should remain available as `billing:2.4`. The pipeline also needs to confirm the remote repository has the expected tag. Which TWO actions are appropriate? Select TWO.

Correct Answer: D. After pushing, query the registry or use its supported interface to verify the `finance/billing` repository and `2.4` tag.; E. Log in to `registry.example.com:5000`, tag the local image with the fully qualified repository name, and push that tag.
Explanation:

A registry-qualified tag identifies the destination repository, and `docker push` uploads the image to that registry using the authenticated credentials. Tagging adds another reference to the same local image, so the original `billing:2.4` name can remain. `docker save` creates an archive rather than publishing to a registry, and logging in does not make an unqualified image name target that registry. Verification should inspect the registry's repository/tag state rather than infer success from a local tag.

Question 7

New Single answer

Topic: Domain 2: Image Creation, Management, and Registry

Skill tested: Selects Dockerfile instructions that distinguish image metadata from container startup behavior.

A vendor image must run a monitoring agent whenever a container starts. Operators must be able to pass additional command-line arguments at `docker run` time without replacing the agent executable. The image should also document the container port used by the agent, but publishing that port must remain the operator's decision. Which Dockerfile design best meets these requirements?

Correct Answer: A. Use `ENTRYPOINT ["agent"]` and `EXPOSE 9100`; let runtime arguments follow the entry point and publish the port explicitly when needed.
Explanation:

An exec-form `ENTRYPOINT` establishes the main executable, and arguments supplied when starting the container are appended to it unless an entry point override is used. `EXPOSE` records intended container-port metadata; it does not publish a host port, so operators can choose whether and how to publish it. `CMD` alone is replaceable by the runtime command, while `RUN` executes during image build and does not define the container's startup process. A volume is not appropriate for storing an executable.

Question 8

New Single answer

Topic: Domain 2: Image Creation, Management, and Registry

Skill tested: Uses image inspection and formatting to extract specific metadata reliably.

An operations script must report the configured default command for each image in a release manifest. The script cannot parse human-oriented `docker image ls` output, and the command must distinguish image metadata from the command currently running in a container. The team wants a concise value suitable for automation and has a list of exact image references. Which approach is best?

Correct Answer: D. Use `docker image inspect` with a Go-template format that selects the image configuration's `Cmd` field.
Explanation:

`docker image inspect` returns structured image configuration, including the configured `Cmd` field, and its formatting option can extract that field for each specified image. The image-list command is not a reliable source for this metadata. A container's process table reflects runtime behavior and may be altered by entry point handling or a command override. `docker history` describes layer-building history, not a canonical parsed default command.

Question 9

New Single answer

Topic: Domain 3: Installation and Configuration

Skill tested: Configures Docker daemon logging and verifies the effective default logging driver.

A Linux fleet writes container logs to the local journald service so administrators can centralize collection through existing host tooling. New containers currently use the `json-file` driver unless developers specify a logging option. The operations team wants journald to be the daemon-wide default while preserving the ability for individual containers to override it. Which configuration and verification approach is most appropriate?

Correct Answer: B. Set `"log-driver": "journald"` in the Docker daemon configuration, restart the daemon as required, and verify the effective driver with `docker info` and container inspection.
Explanation:

The Docker daemon's `log-driver` setting establishes the default for containers that do not specify another logging driver. Updating daemon configuration generally requires a daemon restart for the new default to take effect; existing containers do not automatically change their logging configuration. `docker info` reports daemon defaults, while container inspection can show the driver configured for a specific container. Dockerfiles do not set the daemon logging default, and a storage driver manages image/container filesystems rather than logs.

Question 10

New Multiple answers

Topic: Domain 3: Installation and Configuration

Skill tested: Plans safe Swarm manager recovery by preserving and backing up Raft state.

A company operates a three-manager Swarm and is preparing maintenance on the manager hosts. The cluster currently has quorum, and the change plan requires recovery capability if a manager's local state is lost. The managers use Docker's default Swarm data directory, and the team must avoid backing up a live, inconsistent Raft database. Which TWO actions belong in a sound backup and recovery plan? Select TWO.

Correct Answer: A. Back up the manager's Swarm data directory while the Docker daemon is stopped, and protect the backup as sensitive cluster state.; C. Use the Swarm manager data directory, normally `/var/lib/docker/swarm`, as the state to preserve, following a controlled daemon-stop procedure.
Explanation:

Swarm manager state, including Raft-related data, resides in the manager's Swarm data directory, normally `/var/lib/docker/swarm`. The backup procedure should stop the Docker daemon to avoid copying mutable state inconsistently, and the backup must be tightly protected because it contains sensitive cluster information. The container runtime directory alone is not a substitute for Swarm state. Workers do not hold manager quorum state, and deleting the directory cannot reconstruct the lost state automatically.

Question 11

New Single answer

Topic: Domain 4: Networking

Skill tested: Compares ingress and host port publishing behavior for Swarm services.

A global Swarm service runs one task on every eligible node. It must accept client traffic only when a task is running on the node the client reaches; the organization does not want the routing mesh to forward traffic to a task on another node. The service port is already available for binding on each node, and the client uses node-specific DNS. Which publish configuration best matches the requirement?

Correct Answer: D. Publish the port in host mode so the port is bound directly on nodes where tasks run.
Explanation:

Host-mode publishing binds the published port on the node running the task, avoiding the routing mesh's forwarding behavior. With a global service, each eligible node can run a task and expose that port locally, assuming the port is available. Ingress mode uses the routing mesh and can direct traffic to a task on another node, contrary to the stated constraint. An overlay VIP is not automatically an externally published endpoint, and standalone containers do not become Swarm service tasks.

Question 12

New Single answer

Topic: Domain 4: Networking

Skill tested: Builds isolated user-defined bridge networks for container communication.

A software team runs integration tests with multiple standalone containers on one Docker host. The database and test runner should resolve one another by container name, while unrelated containers on the host should not join their network. No cross-host connectivity is required, and the tests should not depend on links or fixed container IP addresses. Which design is most appropriate?

Correct Answer: D. Create a user-defined bridge network and attach only the database and test-runner containers to it.
Explanation:

A user-defined bridge network provides isolation on a single Docker host and supports container-name-based DNS resolution for attached containers. Attaching only the relevant test containers limits network membership. The default bridge does not provide the same automatic name-based resolution behavior, and fixed IPs create unnecessary coupling. Host networking removes network isolation and does not supply the requested Docker network name resolution. Overlay networking is intended for multi-host communication and adds unnecessary complexity here.

Question 13

New Multiple answers

Topic: Domain 4: Networking

Skill tested: Diagnoses external connectivity failures by separating published ports from container ports.

A Swarm service listens on TCP 8080 inside its tasks. Operators published target port 8080 as port 18080 in ingress mode. The service is reachable through `node-a:18080` but not through `node-b:18080`, even though `node-b` has no task for the service. Firewall rules allow traffic to node-a but block TCP 18080 to node-b. The application must be reachable through any Swarm node, subject to network security policy. Which TWO conclusions or actions are correct? Select TWO.

Correct Answer: B. Ingress publishing provides a routing-mesh endpoint on Swarm nodes, including nodes without a local task, if network access to the published port is allowed.; D. Allow the required TCP 18080 traffic through the firewall to node-b, then retest the routing-mesh endpoint.
Explanation:

In ingress mode, the routing mesh accepts traffic on the published port across Swarm nodes and forwards it to an available service task, even when the receiving node has no local task. The firewall difference explains the observed reachability, so allowing the published TCP port to node-b is the relevant next step. The target port remains the port inside the task, while the published port is the client-facing port; they need not match. Host mode does not create a cluster-wide endpoint.

Question 14

New Multiple answers

Topic: Domain 5: Security

Skill tested: Enables Docker Content Trust and verifies signed image tags before deployment.

A regulated team pulls release images from a registry and wants Docker clients to reject tagged images that lack trusted signatures. The team already has signing keys and a process for signing release tags. Developers must not accidentally disable verification in the deployment environment, and the policy applies to image pulls as well as pushes. Which TWO steps best implement this control? Select TWO.

Correct Answer: B. Ensure release tags are signed and deploy those exact trusted tags from the registry.; E. Enable Docker Content Trust in the clients' environment, such as with `DOCKER_CONTENT_TRUST=1`, for the relevant Docker commands.
Explanation:

Docker Content Trust uses Notary-backed trust data to verify signed image tags when trust is enabled for Docker client operations. Enabling the setting in the deployment environment causes operations to enforce trust rather than merely relying on an organizational convention. The release process must sign the exact tags that consumers deploy. Pruning images does not validate signatures, a tag name alone is not cryptographic evidence, and disabling TLS weakens transport security rather than enabling trust verification.

Question 15

New Single answer

Topic: Domain 5: Security

Skill tested: Applies least-privilege UCP RBAC to grant scoped team access.

An organization uses UCP to manage a Swarm cluster. A release team must deploy and update services only within the `staging` collection. It must not administer UCP, change cluster-wide policies, or access production collections. The team should authenticate through the organization's existing directory integration, and administrators want access managed as a group rather than by adding individual users to each resource. Which approach best satisfies these requirements?

Correct Answer: C. Create or synchronize a directory-backed team, then grant it the narrowest role that permits service deployment on the `staging` collection.
Explanation:

UCP RBAC can associate users or teams with roles scoped to collections. A directory-backed group centralizes membership management, while granting only the permissions needed for deployment in `staging` follows least privilege. An administrator role is unnecessarily broad, and Swarm placement constraints control task scheduling rather than user authorization. Manager certificates grant access to the Docker control plane and do not provide the stated collection-scoped restrictions.