Docker Certified Associate (DCA) Exam-style mock test
Docker Certified Associate (DCA) Practice Exams|Practice test
Full explanations
Exam format
Pass line 65%
33 USD One-time · lifetime access
Enroll →
Sample questions
Example1 · Docker Orchestration: Swarm, Services, and Stacks
A B2B SaaS platform team is bootstrapping a new swarm on their first bare-metal host. An engineer runs 'docker swarm init' successfully. To bring additional compute nodes into the cluster as workers, what must the engineer retrieve from the manager and run on each new host?
・A new TLS certificate bundle exported from the manager and manually imported onto every joining node before the daemon starts
Incorrect. Swarm mutual TLS certificates are issued automatically by the manager's built-in CA during join; you do not export and import certificate bundles by hand.
✓The worker join token obtained via 'docker swarm join-token worker', used in the 'docker swarm join' command
Correct. 'docker swarm join-token worker' prints the token and 'docker swarm join' command that each host runs to enroll as a worker.
・The Raft consensus log snapshot copied to each node so the worker can replay the current cluster state locally
Incorrect. The Raft log is internal to manager consensus and is never copied to workers; workers do not participate in Raft.
・A manager promotion token, since all nodes must first join as managers and then be demoted
Incorrect. Nodes join directly with a worker token; there is no requirement to join as managers first and then demote them.
Explanation
Workers enroll by running the join command containing the worker join token, which the manager prints via 'docker swarm join-token worker'. TLS is handled automatically and Raft is manager-only.
Example2 · Image Creation, Management, and Registry
A B2B SaaS team packages a billing service so that its container always runs the compiled binary /app/billing, but operators can append flags such as --verbose at docker run time without replacing the program. Which Dockerfile approach meets this requirement?
✓Set ENTRYPOINT ["/app/billing"] and provide default flags using CMD ["--quiet"]
Correct. Exec-form ENTRYPOINT fixes /app/billing as the executable, while CMD supplies default args that run-time arguments replace, so appended flags are passed to the binary.
・Set CMD /app/billing so the shell form lets operators append any additional runtime flags they need
Incorrect. Shell-form CMD is fully overridden by any run-time argument and does not guarantee the binary always runs.
・Set ENTRYPOINT /app/billing --quiet using the shell form so the binary is fixed and defaults apply
Incorrect. Shell-form ENTRYPOINT wraps the command in /bin/sh -c, which blocks run-time arguments from being appended and breaks signal handling.
・Set CMD ["/app/billing", "--quiet"] and rely on docker run overriding only the flags portion of CMD
Incorrect. Providing only CMD means any run-time argument replaces the whole command, so the binary is not guaranteed to run.
Explanation
ENTRYPOINT in exec form fixes the executable while CMD provides overridable default arguments; run-time args replace CMD and are appended to ENTRYPOINT.
Example3 · Installation, Configuration, and the Docker Engine
A B2B SaaS platform engineer is provisioning a new Ubuntu host for the billing service and must configure the Docker daemon's default logging driver, registry mirror, and storage driver in a persistent, declarative way that survives engine upgrades. Which approach should the engineer use?
✓Edit /etc/docker/daemon.json with the desired keys and restart the Docker daemon
Correct. /etc/docker/daemon.json is the supported persistent configuration file for daemon-wide settings like logging driver, registry mirrors, and storage driver, applied after a daemon restart.
・Pass the flags individually to every docker run command executed on the host
Incorrect. Per-container run flags do not set daemon-wide defaults and would have to be repeated for every container, which is not persistent host configuration.
・Export the settings as shell environment variables inside the engineer's interactive login profile
Incorrect. The Docker daemon does not read logging or storage driver settings from a user's shell environment variables.
・Append the configuration options as command-line flags to the dockerd process by editing the generated systemd unit file directly
Incorrect. Editing the generated unit's ExecStart works but is fragile and discouraged; daemon.json is the recommended persistent mechanism and a drop-in should be used if flags are needed.
Explanation
Daemon-wide defaults are configured persistently through /etc/docker/daemon.json followed by a daemon restart, rather than per-container flags or environment variables.
Example4 · Networking: Drivers, Overlay, and Service Discovery
A healthcare services firm runs a billing API and a PostgreSQL container on one standalone Docker host. The two containers must reach each other by name and stay isolated from containers in other projects on the same host. Which network driver should the administrator create a user-defined network with?
・The macvlan driver, which assigns each container a MAC address and exposes it directly on the physical LAN segment
Incorrect. Macvlan places containers directly on the physical LAN with their own MAC addresses, which is unnecessary here and does not provide the simple project-scoped isolation requested.
・The host driver, which removes network isolation by sharing the host network stack with the containers
Incorrect. The host driver shares the host's network stack and removes isolation, so the two containers would not be isolated from other projects as required.
✓The bridge driver on a user-defined network
Correct. A user-defined bridge network provides automatic DNS-based name resolution between the two containers and isolates them from containers on other user-defined bridges on the same host.
・The overlay driver, spanning multiple Docker hosts that participate in a swarm cluster
Incorrect. Overlay networks span multiple hosts in a swarm and are overkill for two containers running on one standalone host.
Explanation
For single-host container-to-container communication by name with project isolation, a user-defined bridge network is the correct choice; it provides embedded DNS resolution that the default bridge lacks.
Example5 · Storage, Volumes, and Security
A healthcare services firm runs a PostgreSQL container that stores patient scheduling records. The ops team needs the data to survive container recreation and be managed entirely by Docker rather than tied to a fixed host path. Which approach meets this requirement?
✓Create a named volume and mount it at the database data directory inside the container
Correct. A named volume is fully managed by Docker, decoupled from any host path, and persists independently of the container lifecycle.
・Bind mount the host directory /srv/pgdata directly onto the container's data directory for the database
Incorrect. A bind mount ties the data to a specific host path rather than letting Docker manage it as requested.
・Rely on the container's writable layer, which Docker automatically persists across container restarts and removals
Incorrect. The container's writable layer is destroyed when the container is removed, so it does not provide persistence.
・Pass the --read-only flag so the data directory is preserved and cannot be deleted by the container
Incorrect. The --read-only flag prevents writes to the filesystem and does nothing to persist the database data.
Explanation
Named volumes are the Docker-managed, path-independent mechanism for persisting data beyond a container's lifecycle.
Example6 · Docker Orchestration: Swarm, Services, and Stacks
A healthcare services firm is bootstrapping a new Docker Swarm cluster on a host whose primary NIC has IP 10.20.3.5. The engineer runs the init command but wants other nodes to use the 10.20.3.5 interface for management traffic rather than a secondary NIC. Which command correctly initializes the swarm for this requirement?
✓docker swarm init --advertise-addr 10.20.3.5
Correct. The --advertise-addr flag on docker swarm init pins the address other nodes use to reach this manager for swarm management traffic.
・docker node promote 10.20.3.5 --role manager
Incorrect. docker node promote changes an existing node's role to manager; it does not initialize a swarm or set an advertise address.
・docker swarm join --token SWMTKN 10.20.3.5:2377
Incorrect. docker swarm join adds a node to an existing swarm using a token and is not used to create the cluster.
・docker swarm init with the node joined first and the management interface pinned afterward using the advertise flag set to 10.20.3.5
Incorrect. A node cannot join a swarm that has not been initialized, so pinning the interface afterward is not a valid sequence.
Explanation
docker swarm init --advertise-addr specifies the interface used for swarm management communication when a host has multiple addresses.
Example7 · Docker Orchestration: Swarm, Services, and Stacks
An engineer at the retailer UrbanThread is converting a standalone Docker host into the first node of a new Swarm cluster for the checkout platform. Which command correctly bootstraps the cluster and makes this host the first manager?
・docker node promote --advertise-addr 10.0.5.10 to designate this host as the leading manager node in a new cluster
Incorrect. docker node promote only changes the role of an existing worker that has already joined a swarm; it cannot create a swarm.
・docker swarm join --token manager 10.0.5.10:2377
Incorrect. docker swarm join adds a node to an existing swarm using a token; it does not initialize a new cluster.
✓docker swarm init --advertise-addr 10.0.5.10
Correct. docker swarm init creates the swarm, makes the current host the first manager (the leader), and generates join tokens, with --advertise-addr specifying the address other nodes use.
・docker service create --mode global swarm-init
Incorrect. docker service create deploys an application service and plays no part in forming the swarm itself.
Explanation
A swarm is bootstrapped with docker swarm init, which turns the current node into the first manager and leader. Join and promote commands assume a swarm already exists.
Example8 · Docker Orchestration: Swarm, Services, and Stacks
UrbanThread's platform team needs to retrieve the exact command and token required to add additional worker nodes to the existing production swarm. From a manager node, which command displays this?
・docker node ls --filter role=worker
Incorrect. docker node ls lists existing nodes and their status; it does not reveal the join token for new workers.
✓docker swarm join-token worker
Correct. docker swarm join-token worker prints the full docker swarm join command, including the current worker token and manager address.
・docker swarm join-token worker --quiet --format retrieve-command-and-print-full-join-string
Incorrect. The --quiet flag prints only the token with no surrounding command, and that long format string is not a valid option combination.
・docker swarm update --worker-token
Incorrect. docker swarm update changes swarm-wide settings and can rotate tokens, but it does not display the join command.
Explanation
docker swarm join-token worker outputs the ready-to-run join command and the worker token. node ls only lists nodes, and update only modifies configuration.
Example9 · Docker Orchestration: Swarm, Services, and Stacks
UrbanThread runs a replicated service named catalog-api with 6 replicas. During a flash sale, an operator must raise it to 10 replicas without recreating the service. Which command achieves this?
・docker service update --replicas 10 catalog-api
Incorrect. docker service update --replicas 10 catalog-api would also work, but this option lists it in a form that is valid; however the intended single-purpose scaling command is service scale.
✓docker service scale catalog-api=10
Correct. docker service scale catalog-api=10 directly sets the desired replica count to 10, and the swarm reconciliation loop schedules the additional tasks.
・docker service create --replicas 10 --name catalog-api urbanthread/catalog-api followed by removing the old one
Incorrect. Creating a brand-new service and removing the old one recreates rather than scales it, causing unnecessary churn and a name conflict.
・docker container run --scale 10 catalog-api
Incorrect. docker container run starts a single standalone container and has no --scale flag in this context.
Explanation
docker service scale sets a new desired replica count and the orchestrator reconciles to it. Recreating the service or running standalone containers is incorrect for scaling.
Example10 · Docker Orchestration: Swarm, Services, and Stacks
A financial services firm is bootstrapping a new Docker Swarm cluster on three freshly provisioned bare-metal hosts in its data center. An engineer runs 'docker swarm init' on the first host. What is the direct result of this command on that host?
✓The host is promoted to be a manager node and becomes the leader of a newly created single-node swarm
Correct. 'docker swarm init' creates a new swarm on that host and promotes it to manager, where it serves as the initial leader.
・The host registers as a worker that must wait for a separate manager to approve and admit it into the cluster
Incorrect. Workers join an existing swarm with a join token; init does not create a worker awaiting approval.
・The host enters a pending state and stays idle until a second host joins to establish a manager quorum
Incorrect. A single-node swarm already has quorum with one manager; it does not wait for a second host.
・The host creates the swarm and immediately distributes the raft log to the other two hosts automatically
Incorrect. Other hosts must explicitly run 'docker swarm join'; raft data is not pushed to hosts that have not joined.
Explanation
Running 'docker swarm init' turns the current host into the first manager (leader) of a brand-new swarm, which other nodes then join using tokens.
Example11 · Docker Orchestration: Swarm, Services, and Stacks
After initializing the swarm, a platform engineer at the bank needs to add two additional hosts as worker nodes. She lost the output of the init command. From a manager node, which command retrieves the exact command and token needed to join new workers?
✓docker swarm join-token worker
Correct. 'docker swarm join-token worker' prints the full join command, including the current worker token and manager address.
・docker node inspect self --format '{{.JoinToken}}' --worker
Incorrect. 'docker node inspect' reports node metadata and does not expose a usable join token in that form.
・docker swarm join --token worker --list-pending-nodes
Incorrect. 'docker swarm join' is run on the joining host, and there is no --list-pending-nodes flag for retrieving tokens.
・docker node ls --filter role=worker
Incorrect. 'docker node ls' lists existing members and cannot produce a join token for new hosts.
Explanation
The 'docker swarm join-token worker' command, run on a manager, outputs the complete join command and token required for new worker nodes.
Example12 · Docker Orchestration: Swarm, Services, and Stacks
A manufacturing distributor is standing up its first swarm cluster on a server in the warehouse. An engineer runs 'docker swarm init' on that single host. What is the immediate result regarding node roles?
✓The host becomes the leader manager and is also able to run service tasks as a worker
Correct. The node that runs 'docker swarm init' becomes the leader manager and by default also accepts and runs tasks, so a single-node swarm can schedule services immediately.
・The host becomes a worker node that must wait for a separate manager to join before any service can be scheduled onto the cluster
Incorrect. The initializing node becomes a manager, not a worker waiting for a manager to join.
・The host becomes a manager node only, and a second host must be added before any tasks can run
Incorrect. Managers also act as workers by default, so no second host is required to run tasks.
・The host stays a standalone Docker engine until at least three managers join to form a quorum
Incorrect. 'docker swarm init' immediately activates swarm mode; a three-manager quorum is a recommendation, not a requirement to run tasks.
Explanation
The first node in 'docker swarm init' becomes the leader manager and runs tasks by default, enabling a functional single-node swarm.
Example13 · Docker Orchestration: Swarm, Services, and Stacks
The distributor wants to add three new packing-line servers to the existing swarm as workers. An operator needs the exact command to run on each new server. What is the correct way to obtain the worker join command on a manager?
・Run 'docker node promote' on the manager and then copy the generated certificate bundle to each worker server before joining
Incorrect. 'docker node promote' changes a worker to a manager and does not generate a worker join command.
✓Run 'docker swarm join-token worker' on a manager to print the join command and token, then run that command on each worker
Correct. 'docker swarm join-token worker' on a manager prints the full 'docker swarm join' command including the worker token to run on each new node.
・Export the swarm CA from the manager and manually register each new worker host in the node inventory file
Incorrect. The swarm manages CA and node registration automatically; there is no manual inventory file to edit.
・Run 'docker swarm join' on the manager to list the pending workers
Incorrect. 'docker swarm join' is run on the joining worker, not on the manager to list pending nodes.
Explanation
'docker swarm join-token worker' returns the ready-to-run join command and token for adding worker nodes.
Example14 · Docker Orchestration: Swarm, Services, and Stacks
A telecom operator's network engineer runs 'docker swarm init' on a bare Docker host to build a new cluster for billing microservices. Immediately after the command succeeds, what is the state of this node within the newly created swarm?
・It joins as a worker node and waits to be promoted to manager by an external orchestrator before scheduling tasks
Incorrect. 'docker swarm init' creates a manager, not a worker awaiting external promotion; no external orchestrator is involved.
✓It becomes the first manager node, acting as the leader of the Raft consensus group
Correct. The node that runs 'docker swarm init' becomes the first manager and leader of the Raft consensus group.
・It registers only as a load balancer endpoint and cannot run any service tasks until workers join
Incorrect. The node is a full manager that can also schedule and run tasks; it is not merely a load balancer.
・It remains in a pending state until at least two additional manager nodes join to form a quorum
Incorrect. A single manager forms a valid quorum of one; it does not wait for additional managers to become active.
Explanation
Running 'docker swarm init' promotes the current host to the first manager node, which becomes the Raft leader and can immediately schedule tasks.
Example15 · Docker Orchestration: Swarm, Services, and Stacks
The telecom operator wants its production swarm to tolerate the simultaneous loss of two manager nodes while still maintaining quorum. What is the minimum number of manager nodes the cluster must have?
・Four manager nodes, so that a majority of three remains after losing two from the group
Incorrect. With four managers, losing two leaves two, which is not a majority of four, so quorum is lost.
・Three manager nodes distributed across separate availability zones for resilience
Incorrect. With three managers, losing two leaves one, which cannot form a majority of three.
✓Five manager nodes
Correct. Five managers tolerate the loss of two because three remaining nodes still form a majority quorum.
・Seven manager nodes to guarantee Raft consensus under a double failure
Incorrect. Seven managers can tolerate three failures but is more than the minimum required to tolerate two.
Explanation
Raft quorum requires a strict majority; to tolerate two failures you need (2*2)+1 = 5 manager nodes so that three survivors remain.
▶ Try 10 free questions (graded)