DCA Technology & Digital Tools 4 — Questions and Answers
Question 1: Which command exports a Docker container's filesystem as a tar archive (not an image)?
- docker save
- docker commit
- docker export (Correct answer)
- docker cp
Correct answer: docker export
`docker export` streams the container's filesystem as a flat tar; unlike `docker save`, it does not preserve image layers or metadata.
Question 2: What networking mode allows a container to share the host machine's network stack directly?
- bridge
- overlay
- host (Correct answer)
- none
Correct answer: host
In `host` network mode, the container bypasses network namespacing and uses the host's interfaces and ports directly.
Question 3: In Docker Compose, which key under a service definition maps to `docker run --restart`?
- restart_policy
- restart (Correct answer)
- deploy.restart_policy
- healthcheck.restart
Correct answer: restart
The `restart` key in a Compose service definition (e.g., `restart: always`) maps directly to Docker's restart policy.
Question 4: Which Docker object stores sensitive data like passwords and TLS certificates, injecting them into containers without embedding in images?
- Config
- Volume
- Secret (Correct answer)
- Bind mount
Correct answer: Secret
Docker Secrets are encrypted at rest in the Swarm Raft log and mounted into authorized containers as in-memory tmpfs files.
Question 5: What is the effect of running `docker system prune -a`?
- Removes only stopped containers
- Removes all unused containers, networks, images (including tagged), and build cache (Correct answer)
- Removes only dangling images and stopped containers
- Resets Docker daemon configuration to defaults
Correct answer: Removes all unused containers, networks, images (including tagged), and build cache
`docker system prune -a` reclaims space by removing all unused resources including tagged images not referenced by any container.
Question 6: Which Dockerfile instruction copies files from the build context and can automatically extract tar archives?
- COPY
- RUN cp
- ADD (Correct answer)
- IMPORT
Correct answer: ADD
`ADD` supports local tar extraction and URL sources in addition to simple file copies, unlike `COPY` which is strictly a copy.
Question 7: What is the minimum number of manager nodes recommended for a fault-tolerant Docker Swarm that can lose one manager?
- 1
- 2
- 3 (Correct answer)
- 5
Correct answer: 3
A 3-manager swarm maintains quorum (2 of 3) even if one manager fails, providing the minimum recommended fault tolerance.
Which command exports a Docker container's filesystem as a tar archive (not an image)?