Docsity

Docker Certified Associate DCA Certification Ultimate Exam, Exams of Technology

Toggle sidebar
bg1
Docker Certified Associate DCA
Certification Ultimate Exam
Question 1. Which component of the Docker architecture is responsible for building images from a
Dockerfile?A) Docker EngineB) Docker DaemonC) Docker BuilderD) Docker CLIAnswer: CExplanation: The
Docker Builder (part of the Docker Engine) processes Dockerfiles to create images.
Question 2. In Docker terminology, what does the term “layer” refer to?A) A running container
instanceB) A read‑only part of an image created by a Dockerfile instructionC) A network interface inside
a containerD) A mounted volumeAnswer: BExplanation: Each instruction in a Dockerfile creates a new
immutable layer that forms part of the final image.
Question 3. Which command lists all images stored locally on the host?A) docker ps –aB) docker
imagesC) docker exec –listD) docker ls imagesAnswer: BExplanation: docker images displays the
repository, tag, image ID, and size of each local image.
Question 4. What is the default network driver used when you run docker run without specifying a
network?A) hostB) bridgeC) overlayD) macvlanAnswer: BExplanation: Docker creates a default bridge
network (bridge) for containers unless another driver is specified.
Question 5. Which of the following statements about Docker volumes is FALSE?A) Volumes are stored
outside the Union File System.B) Volumes can be shared between multiple containers.C) Deleting a
container automatically deletes its associated volumes.D) Volumes are managed by the Docker
Engine.Answer: CExplanation: Volumes persist after container removal unless explicitly removed with
docker volume rm or --rm with --volumes.
Question 6. Which flag adds a read‑only bind mount to a container?A) --read-onlyB) --volume
/host:/container:roC) --mount type=bind,source=/host,target=/container,readonlyD) Both B and
CAnswer: DExplanation: Both the -v syntax with :ro and the --mount syntax with readonly create a
read‑only bind mount.
Question 7. What does the docker swarm init command do?A) Creates a new Docker Compose
project.B) Turns the current Docker Engine into a swarm manager.C) Deploys a stack to a Kubernetes
cluster.D) Generates a Dockerfile from a running container.Answer: BExplanation: docker swarm init
initializes the node as a manager in a new Swarm cluster.
Question 8. In a Swarm, which role can schedule tasks on any node in the cluster?A) WorkerB)
ManagerC) LeaderD) DispatcherAnswer: BExplanation: Manager nodes have the authority to schedule
services on any node, while workers only run assigned tasks.
Question 9. Which command is used to view the logs of a specific service in a Swarm?A) docker service
logs <service>B) docker logs <service>C) docker swarm logs <service>D) docker inspect --log
<service>Answer: AExplanation: docker service logs streams logs from all tasks belonging to the
specified service.
Question 10. What is the purpose of the --restart=unless-stopped policy?A) Restart the container only
when the Docker daemon restarts.B) Restart the container automatically unless it was stopped
manually.C) Prevent the container from ever restarting.D) Restart the container only on failure.Answer:
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Docker Certified Associate DCA Certification Ultimate Exam and more Exams Technology in PDF only on Docsity!

Certification Ultimate Exam

Question 1. Which component of the Docker architecture is responsible for building images from a Dockerfile?A) Docker EngineB) Docker DaemonC) Docker BuilderD) Docker CLIAnswer: CExplanation: The Docker Builder (part of the Docker Engine) processes Dockerfiles to create images. Question 2. In Docker terminology, what does the term “layer” refer to?A) A running container instanceB) A read‑only part of an image created by a Dockerfile instructionC) A network interface inside a containerD) A mounted volumeAnswer: BExplanation: Each instruction in a Dockerfile creates a new immutable layer that forms part of the final image. Question 3. Which command lists all images stored locally on the host?A) docker ps – aB) docker imagesC) docker exec – listD) docker ls imagesAnswer: BExplanation: docker images displays the repository, tag, image ID, and size of each local image. Question 4. What is the default network driver used when you run docker run without specifying a network?A) hostB) bridgeC) overlayD) macvlanAnswer: BExplanation: Docker creates a default bridge network (bridge) for containers unless another driver is specified. Question 5. Which of the following statements about Docker volumes is FALSE?A) Volumes are stored outside the Union File System.B) Volumes can be shared between multiple containers.C) Deleting a container automatically deletes its associated volumes.D) Volumes are managed by the Docker Engine.Answer: CExplanation: Volumes persist after container removal unless explicitly removed with docker volume rm or --rm with --volumes. Question 6. Which flag adds a read‑only bind mount to a container?A) --read-onlyB) --volume /host:/container:roC) --mount type=bind,source=/host,target=/container,readonlyD) Both B and CAnswer: DExplanation: Both the - v syntax with :ro and the --mount syntax with readonly create a read‑only bind mount. Question 7. What does the docker swarm init command do?A) Creates a new Docker Compose project.B) Turns the current Docker Engine into a swarm manager.C) Deploys a stack to a Kubernetes cluster.D) Generates a Dockerfile from a running container.Answer: BExplanation: docker swarm init initializes the node as a manager in a new Swarm cluster. Question 8. In a Swarm, which role can schedule tasks on any node in the cluster?A) WorkerB) ManagerC) LeaderD) DispatcherAnswer: BExplanation: Manager nodes have the authority to schedule services on any node, while workers only run assigned tasks. Question 9. Which command is used to view the logs of a specific service in a Swarm?A) docker service logs B) docker logs C) docker swarm logs D) docker inspect --log Answer: AExplanation: docker service logs streams logs from all tasks belonging to the specified service. Question 10. What is the purpose of the --restart=unless-stopped policy?A) Restart the container only when the Docker daemon restarts.B) Restart the container automatically unless it was stopped manually.C) Prevent the container from ever restarting.D) Restart the container only on failure.Answer:

Certification Ultimate Exam

BExplanation: The policy restarts containers after daemon or system restarts unless the user has explicitly stopped them. Question 11. Which of the following best describes a multi‑stage Dockerfile?A) A Dockerfile that builds multiple images simultaneously.B) A Dockerfile that uses several FROM statements to reduce final image size.C) A Dockerfile that runs in parallel on multiple hosts.D) A Dockerfile that includes both build and runtime dependencies in one stage.Answer: BExplanation: Multi‑stage builds use intermediate images to copy only needed artifacts into the final image, minimizing size. Question 12. When you push an image to Docker Hub, which component authenticates your credentials?A) Docker DaemonB) Docker EngineC) Docker Registry HTTP APID) Docker CLIAnswer: CExplanation: The Docker Registry HTTP API handles authentication when the client (CLI) pushes images. Question 13. Which command removes all stopped containers, unused networks, dangling images, and build cache?A) docker system prune - aB) docker clean allC) docker prune --allD) docker gcAnswer: AExplanation: docker system prune - a performs a comprehensive cleanup of unused Docker resources. Question 14. In Docker Compose, what does the depends_on key control?A) The order in which containers are built.B) The order in which containers are started and stopped.C) Network alias creation.D) Volume sharing between services.Answer: BExplanation: depends_on expresses startup and shutdown ordering dependencies between services. Question 15. Which of the following is a valid way to limit CPU usage for a container?A) --cpu-shares 512B) --cpus 0.5C) --cpu-quota 50000D) All of the aboveAnswer: DExplanation: All three flags control CPU resources: shares (relative weight), cpus (fractional cores), and quota (microseconds of CPU time). Question 16. What does the docker exec - it /bin/sh command do?A) Starts a new container from the same image.B) Opens an interactive shell inside the running container.C) Commits the container’s state to a new image.D) Restarts the container with a new entrypoint.Answer: BExplanation: docker exec runs a command in a running container; - it provides an interactive terminal. Question 17. Which file format does Docker use to define multi‑container applications?A) DockerfileB) Dockerfile.ymlC) docker-compose.ymlD) swarm.yamlAnswer: CExplanation: docker-compose.yml describes services, networks, and volumes for a multi‑container app. Question 18. What is the default storage driver on most modern Linux distributions for Docker?A) aufsB) overlay2C) devicemapperD) btrfsAnswer: BExplanation: overlay2 is the default driver due to its performance and stability on recent kernels. Question 19. Which command displays the current resource usage of containers (CPU, memory, network, etc.)?A) docker statsB) docker topC) docker infoD) docker monitorAnswer: AExplanation: docker stats streams live metrics for each running container. Question 20. In a Swarm overlay network, what is the role of the “ingress” network?A) Provides internal DNS resolution.B) Handles routing mesh for published ports.C) Stores encrypted secrets.D) Manages volume drivers.Answer: BExplanation: The ingress overlay network implements the routing mesh that forwards incoming traffic to the appropriate service tasks.

Certification Ultimate Exam

Question 31. Which command creates a new Docker network with driver overlay?A) docker network create --driver overlay mynetB) docker network new --overlay mynetC) docker overlay create mynetD) docker network add overlay mynetAnswer: AExplanation: docker network create with --driver overlay builds a multi‑host network for Swarm services. Question 32. What is the default behavior of docker run regarding container restart policies?A) no – never restart.B) always – always restart.C) on-failure – restart on non‑zero exit code.D) unless-stopped – restart unless manually stopped.Answer: AExplanation: By default, Docker does not apply any restart policy; the container stops and stays stopped. Question 33. Which of the following best describes the purpose of a Docker “tag”?A) A unique identifier for a running container.B) A human‑readable alias for an image version.C) A security label for secret management.D) A network namespace identifier.Answer: BExplanation: Tags (e.g., nginx:1.21) label specific image revisions for easier reference and distribution. Question 34. When a container is started with --cpuset-cpus="0,2", what does this restrict?A) The container can only use 0.2 CPU shares.B) The container can only run on CPU cores 0 and 2.C) The container’s memory is limited to 0‑ 2 GB.D) The container’s I/O bandwidth is throttled.Answer: BExplanation: --cpuset-cpus pins the container’s processes to the specified CPU cores. Question 35. Which command is used to import an image from a tar archive?A) docker load - i .tarB) docker import .tarC) docker pull .tarD) docker save - i .tarAnswer: AExplanation: docker load reads an image archive (created by docker save) and imports it into the local image store. Question 36. How does Docker enforce isolation between containers?A) By creating separate virtual machines.B) Through Linux namespaces and cgroups.C) By encrypting each container’s filesystem.D) Using a proprietary hypervisor.Answer: BExplanation: Namespaces isolate resources (PID, network, mount, etc.) while cgroups enforce resource limits. Question 37. Which flag is required to give a container access to the host’s Docker daemon socket?A) -- privilegedB) - v /var/run/docker.sock:/var/run/docker.sockC) --network hostD) --cap-add SYS_ADMINAnswer: BExplanation: Binding the Docker socket into the container lets it communicate with the host daemon, enabling “Docker‑in‑Docker” patterns. Question 38. What is the purpose of the HEALTHCHECK instruction in a Dockerfile?A) To specify the command that runs when the container starts.B) To define a test that Docker runs to determine if the container is healthy.C) To automatically restart the container on failure.D) To set resource limits for the container.Answer: BExplanation: HEALTHCHECK defines a command that Docker periodically runs; the container’s health status is reported as healthy or unhealthy. Question 39. Which of the following is a valid way to pass an environment variable at container start time?A) docker run - e MYVAR=value …B) docker run --env-file=.env …C) Both A and BD) Neither A nor BAnswer: CExplanation: - e sets a single variable; --env-file loads multiple variables from a file.

Certification Ultimate Exam

Question 40. In Swarm mode, what does the --mode global flag do when creating a service?A) Deploys exactly one task per node in the swarm.B) Deploys the service on all manager nodes only.C) Deploys the service on a single randomly selected node.D) Deploys the service with unlimited replicas.Answer: AExplanation: global mode ensures one task runs on every active node, providing full distribution. Question 41. Which command removes a Docker image by its ID?A) docker rmi B) docker image rm C) Both A and BD) None of the aboveAnswer: CExplanation: Both docker rmi and docker image rm are aliases for deleting an image. Question 42. What is the effect of the --privileged flag on a container?A) Grants the container all Linux capabilities and lifts many security restrictions.B) Limits the container to read‑only file system.C) Enables automatic TLS encryption for container traffic.D) Restricts the container to a single CPU core.Answer: AExplanation: --privileged gives the container full access to host devices and capabilities, effectively disabling many isolation mechanisms. Question 43. Which Docker command is used to retrieve the logs of a stopped container?A) docker logs B) docker inspect --logC) docker events D) docker history Answer: AExplanation: docker logs works for both running and stopped containers, showing stdout/stderr captured during execution. Question 44. In a Docker Compose file, which top‑level key is used to define a custom network?A) networksB) linksC) volumesD) servicesAnswer: AExplanation: The networks section declares user‑defined networks that services can attach to. Question 45. Which statement about Docker’s “copy‑on‑write” (CoW) mechanism is correct?A) It copies the entire image into a new layer for each container.B) It creates a new writable layer on top of read‑only image layers.C) It disables caching of image layers.D) It only works with the devicemapper driver.Answer: BExplanation: CoW adds a thin writable layer above the stacked read‑only layers, allowing changes without duplicating the underlying data. Question 46. What does the docker checkpoint create command do?A) Generates a snapshot of a container’s state using CRIU.B) Saves the container’s logs to a file.C) Commits the container to a new image.D) Restores a stopped container.Answer: AExplanation: Checkpointing captures the process state, allowing later restoration (requires CRIU support). Question 47. Which flag limits the amount of memory a container can use?A) --memoryB) --mem-limitC) --ramD) --memsizeAnswer: AExplanation: --memory (or - m) specifies the maximum amount of RAM the container may allocate. Question 48. In Docker Swarm, what does the term “service discovery” refer to?A) Automatic DNS entry creation for each service name.B) Scanning the host for open ports.C) Detecting new Docker daemons on the network.D) Mapping container IDs to IP addresses.Answer: AExplanation: Swarm’s internal DNS provides name resolution for services, allowing containers to reach myservice without hard‑coding IPs. Question 49. Which of the following is a valid way to limit a container’s block I/O (disk) read rate?A) -- blkio-weightB) --device-read-bps /dev/sda:10mbC) --blkio-weight-device /dev/sda:500D) Both B and

Certification Ultimate Exam

portable across hosts.C) They allow direct access to host hardware devices.D) They automatically encrypt data at rest.Answer: BExplanation: Docker creates and tracks named volumes, making them easier to backup, migrate, and share between containers. Question 60. Which of the following is a valid syntax for specifying a healthcheck in a Dockerfile?A) HEALTHCHECK CMD curl - f http://localhost/ || exit 1B) HEALTHCHECK --interval=30s CMD curl - f http://localhost/C) HEALTHCHECK CMD ["curl","-f","http://localhost/"]D) All of the aboveAnswer: DExplanation: All shown forms follow Dockerfile healthcheck syntax (exec form, shell form, and optional parameters). Question 61. When using Docker Desktop on Windows, which mode runs Linux containers?A) Windows containers modeB) Hyper‑V isolation modeC) LinuxKit VM (LCOW)D) WSL 2 backendAnswer: DExplanation: Docker Desktop leverages the WSL 2 Linux kernel to run Linux containers on Windows. Question 62. Which command displays the current Docker daemon configuration file location?A) docker info --format '{{.DockerRootDir}}'B) docker daemon --configC) docker system infoD) docker versionAnswer: AExplanation: The DockerRootDir field in docker info points to the daemon’s data directory, which contains the config file. Question 63. What does the --log-driver json-file option configure?A) The format of logs stored on the host filesystem.B) That logs are sent to a remote syslog server.C) That logs are disabled for the container.D) That logs are stored in a binary format.Answer: AExplanation: The json-file driver writes container stdout/stderr to JSON‑formatted files on disk. Question 64. Which of the following is true about Docker’s “copy” (COPY) instruction?A) It can copy files from a running container.B) It preserves file ownership and permissions from the host.C) It always creates a new image layer.D) It can only copy files from the build context.Answer: CExplanation: Every COPY (or ADD) creates a new read‑only layer in the image; source files must be inside the build context. Question 65. In a Swarm service, what does the --update-parallelism flag control?A) Number of tasks updated simultaneously during a rolling update.B) Number of replicas to create.C) Number of networks to attach.D) Number of secrets to distribute.Answer: AExplanation: --update-parallelism limits how many tasks are stopped and started at once during an update. Question 66. Which command is used to retrieve the ID of a Docker image given its repository and tag?A) docker images --quiet :B) docker inspect :C) docker ps - q :D) docker locate :Answer: AExplanation: --quiet (-q) outputs only the image ID for matching images. Question 67. What is the purpose of the --cap-add flag?A) To add Linux capabilities to the container’s permission set.B) To increase the container’s CPU quota.C) To attach additional networks.D) To allocate more memory.Answer: AExplanation: --cap-add grants specific capabilities (e.g., NET_ADMIN) that are otherwise dropped for security. Question 68. Which of the following statements about Docker’s ENTRYPOINT and CMD is correct?A) ENTRYPOINT can be overridden at run time, CMD cannot.B) CMD provides default arguments to

Certification Ultimate Exam

ENTRYPOINT.C) Both must be specified in JSON array form.D) Only one of them can exist in a Dockerfile.Answer: BExplanation: CMD supplies default parameters; if an ENTRYPOINT is defined, Docker concatenates them unless overridden. Question 69. When a container is started with --network none, what is true?A) The container has full host networking.B) No network interfaces are created inside the container.C) Only loopback (lo) is available.D) The container can still resolve DNS.Answer: CExplanation: none disables external networking but leaves the loopback interface active. Question 70. Which command shows the current Swarm node’s role (manager or worker)?A) docker node lsB) docker infoC) docker swarm statusD) docker node inspect selfAnswer: DExplanation: docker node inspect self returns JSON with the node’s Spec.Role field. Question 71. What does the --security-opt seccomp=unconfined flag do?A) Disables all seccomp filtering for the container.B) Enables the default Docker seccomp profile.C) Applies a custom seccomp profile located at /etc/seccomp.json.D) Restricts the container to read‑only filesystem.Answer: AExplanation: Setting seccomp=unconfined removes the default syscall restrictions, giving the container full syscall access. Question 72. Which Docker command can be used to pause all processes in a container?A) docker suspend B) docker pause C) docker stop D) docker freeze Answer: BExplanation: docker pause sends SIGSTOP to all processes in the container, freezing its execution. Question 73. In Docker Compose, what does the restart: on-failure policy do?A) Restarts the container only if it exits with a non‑zero status.B) Restarts the container regardless of exit code.C) Restarts the container only when the Docker daemon restarts.D) Prevents the container from ever restarting.Answer: AExplanation: on-failure restarts the service up to a default limit when the exit code indicates an error. Question 74. Which of the following is a valid way to pass a secret to a Swarm service at runtime?A) -- secret source=mysecret,target=/run/secrets/mysecretB) --env MYSECRET=$(cat /run/secrets/mysecret)C) --mount type=secret,source=mysecret,target=/mysecretD) Both A and CAnswer: DExplanation: Secrets can be referenced via --secret (short syntax) or via --mount type=secret. Both make the secret available as a file. Question 75. What does the docker compose up --build command do?A) Starts services without building images.B) Builds images before starting services, even if they already exist.C) Forces a rebuild of all containers from scratch.D) Only builds images, does not start containers.Answer: BExplanation: --build tells Compose to rebuild images before creating containers, ensuring any Dockerfile changes are applied. Question 76. Which of the following statements about the docker events command is correct?A) It displays a live stream of daemon events such as container creation and image pulls.B) It lists all currently running containers.C) It shows the history of image layers.D) It provides a summary of network traffic

Certification Ultimate Exam

regardless of node.C) The DNS resolver used by services.D) The firewall rules applied to each node.Answer: BExplanation: The routing mesh ensures that published ports are reachable on any node, with traffic forwarded to the appropriate service tasks.