DCA Technology & Digital Tools 2 — Questions and Answers
Question 1: Which Docker command displays real-time resource usage statistics for running containers?
- docker inspect
- docker stats (Correct answer)
- docker top
- docker info
Correct answer: docker stats
`docker stats` streams live CPU, memory, network I/O, and block I/O metrics for running containers.
Question 2: What is the default network driver created when Docker is installed on a Linux host?
- overlay
- macvlan
- host
- bridge (Correct answer)
Correct answer: bridge
Docker creates a default `bridge` network (docker0) on installation, used by containers unless another network is specified.
Question 3: In a Dockerfile, which instruction sets environment variables that persist into the running container?
- ARG
- ENV (Correct answer)
- LABEL
- RUN
Correct answer: ENV
`ENV` sets environment variables that are available both during the build and at container runtime.
Question 4: Which Docker Swarm command promotes a worker node to a manager?
- docker node update --role manager <NODE>
- docker swarm promote <NODE>
- docker node promote <NODE> (Correct answer)
- docker swarm update --manager <NODE>
Correct answer: docker node promote <NODE>
`docker node promote <NODE>` changes a worker's role to manager within the swarm cluster.
Question 5: What does the `--read-only` flag do when passed to `docker run`?
- Mounts the host filesystem as read-only
- Makes the container's root filesystem read-only (Correct answer)
- Prevents reading from bind mounts
- Disables volume writes cluster-wide
Correct answer: Makes the container's root filesystem read-only
`--read-only` mounts the container's root filesystem in read-only mode, preventing writes to it at runtime.
Question 6: Which registry component in Docker Trusted Registry (DTR) is responsible for storing image layers?
- Notary server
- Blob store (Correct answer)
- UCP controller
- Registry mirror
Correct answer: Blob store
DTR's blob store persists the actual image layer data, while the registry index tracks metadata and manifests.
Question 7: A service in Docker Swarm is configured with `--update-failure-action rollback`. What happens when an updated task fails its health check?
- The service is paused immediately
- The swarm removes the service
- The swarm automatically rolls back to the previous version (Correct answer)
- The failed task is retried indefinitely
Correct answer: The swarm automatically rolls back to the previous version
With `--update-failure-action rollback`, Swarm automatically reverts the service to its prior configuration when an update task fails.
Which Docker command displays real-time resource usage statistics for running containers?