DCA Financial Management & Budgeting 3 — Questions and Answers
Question 1: You need to pin a container to specific CPU cores to guarantee predictable performance for a critical billing service. Which flag should you use?
- --cpu-shares=1024
- --cpus=2
- --cpuset-cpus=0,1 (Correct answer)
- --cpu-period=100000
Correct answer: --cpuset-cpus=0,1
--cpuset-cpus pins a container to specific CPU core numbers, ensuring it always runs on those cores.
Question 2: A Docker Swarm service is over-provisioned with replicas during off-peak hours. Which command scales it down to 2 replicas to cut costs?
- docker service update --replicas=2 myservice
- docker service scale myservice=2 (Correct answer)
- docker swarm scale myservice 2
- docker service set myservice --count=2
Correct answer: docker service scale myservice=2
docker service scale <service>=<replicas> is the direct command to adjust replica count in Docker Swarm.
Question 3: Which Docker log driver would you choose to minimize local disk consumption while sending logs to a centralized cost-tracked logging service?
- json-file
- local
- syslog
- awslogs (Correct answer)
Correct answer: awslogs
The awslogs driver ships logs directly to Amazon CloudWatch, eliminating local disk usage for log storage.
Question 4: A --memory-reservation flag is set lower than --memory for a container. What does this mean operationally?
- The container will never use more than the reservation amount
- The reservation is a soft limit Docker uses when the host is under memory pressure (Correct answer)
- The container will be OOM-killed at the reservation threshold
- Reservation and hard limit must always be equal
Correct answer: The reservation is a soft limit Docker uses when the host is under memory pressure
Memory reservation is a soft guarantee; Docker tries to reclaim memory from the container down to this level when the host needs it.
Question 5: Which metric from 'docker stats' most directly reflects a container's I/O cost on cloud block storage billed per IOPS?
- MEM USAGE / LIMIT
- NET I/O
- BLOCK I/O (Correct answer)
- CPU %
Correct answer: BLOCK I/O
BLOCK I/O reports bytes read/written to block devices, which maps directly to IOPS-billed cloud storage charges.
Question 6: A development team leaves test containers running on shared infrastructure overnight. Which Docker feature can automatically stop containers after they exit to save costs?
- Docker health checks with --interval
- Container resource limits with --pids-limit
- docker run --stop-timeout
- docker run --rm to auto-remove containers on exit (Correct answer)
Correct answer: docker run --rm to auto-remove containers on exit
The --rm flag automatically removes a container and its filesystem when it exits, preventing orphaned stopped containers from consuming disk.
Question 7: A team uses 'docker volume create' to provision volumes for every test run, never cleaning them up. What cost problem does this create?
- Volumes slow down container networking
- Unused volumes accumulate and consume persistent disk storage over time (Correct answer)
- Docker requires paid licensing for more than 10 volumes
- Named volumes cannot be shared between containers
Correct answer: Unused volumes accumulate and consume persistent disk storage over time
Orphaned volumes persist on disk indefinitely and can consume significant storage, especially on cloud-billed block storage.
You need to pin a container to specific CPU cores to guarantee predictable performance for a critical billing service.
Which flag should you use?