DCA Project Planning & Execution 2 — Questions and Answers
Question 1: When planning a migration of a monolithic application to Docker containers, which approach best minimizes risk?
- Containerize all services simultaneously in a single sprint
- Strangler fig pattern — incrementally containerize one service at a time (Correct answer)
- Rewrite all services from scratch before containerizing
- Deploy containers only in development and keep production on bare metal
Correct answer: Strangler fig pattern — incrementally containerize one service at a time
The strangler fig pattern reduces risk by migrating one service at a time, allowing rollback without full-system impact.
Question 2: A project requires Docker images to be reproducible across CI/CD pipelines. Which Dockerfile best practice ensures this?
- Use the 'latest' tag for base images to always get security patches
- Pin base image versions with specific digest or tag (Correct answer)
- Use FROM scratch to avoid external dependencies
- Rebuild images without caching to ensure freshness
Correct answer: Pin base image versions with specific digest or tag
Pinning base image versions with specific tags or SHA digests ensures identical builds across all environments.
Question 3: During sprint planning for a Docker Swarm deployment project, the team must decide on the number of manager nodes. What is the recommended minimum for high availability?
- 1 manager node is sufficient for any workload
- 2 manager nodes provide the best fault tolerance
- 3 manager nodes provide HA while tolerating 1 failure (Correct answer)
- 5 manager nodes are always required for production
Correct answer: 3 manager nodes provide HA while tolerating 1 failure
Three manager nodes form a quorum that tolerates one node failure; two managers would lose quorum on any failure.
Question 4: A team is planning resource limits for containers in a production Kubernetes cluster. Which flag sets both CPU and memory limits in a Docker run command for testing?
- --cpu-quota and --memory-swap
- --cpus and --memory (Correct answer)
- --cpu-shares and --mem-limit
- --cpu-period and --memory-reservation
Correct answer: --cpus and --memory
The --cpus flag limits CPU cores and --memory limits the container's maximum RAM allocation.
Question 5: When executing a Docker project rollout, a health check fails on new containers. What does Docker Swarm do by default?
- Immediately terminates all tasks and halts the rollout
- Continues the rollout and logs the failure
- Pauses the rollout and keeps the previous version running (Correct answer)
- Restarts the failed container indefinitely without pausing
Correct answer: Pauses the rollout and keeps the previous version running
Docker Swarm's default update failure action is 'pause', preserving the last healthy state while alerting operators.
Question 6: A project plan calls for image scanning before deployment. Which Docker CLI command initiates a vulnerability scan using Docker Scout?
- docker inspect --security <image>
- docker scout cves <image> (Correct answer)
- docker scan --vuln <image>
- docker audit <image>
Correct answer: docker scout cves <image>
The 'docker scout cves' command lists known CVEs in an image using the Docker Scout service.
Question 7: During project execution, an operator needs to run a one-time database migration task in a running Swarm service without creating a permanent task. What is the best approach?
- Scale the service to 0 and run the migration manually
- Use 'docker service update --force' to trigger all tasks to restart
- Deploy a separate one-shot service with --restart-condition=none (Correct answer)
- Exec into an existing container and run the migration
Correct answer: Deploy a separate one-shot service with --restart-condition=none
A service with --restart-condition=none runs once and exits cleanly, making it suitable for one-time migration jobs.
When planning a migration of a monolithic application to Docker containers, which approach best minimizes risk?