mediumMultiple ChoiceObjective-mapped
XK0-006 Practice Question: A DevOps engineer is responsible for deploying a…
A DevOps engineer is responsible for deploying a containerized web application on a Linux server running Docker. The application consists of three services: a frontend (Nginx), a backend (Node.js), and a database (PostgreSQL). The engineer uses Docker Compose to manage the stack. The deployment works correctly on a test environment, but when deployed to production, the frontend service fails to connect to the backend. Both services are on the same custom bridge network. The engineer checks the logs of the frontend container and sees 'getaddrinfo EAI_AGAIN backend-service'. The backend service is running and healthy. The engineer suspects a DNS resolution issue within the Docker network. Which of the following is the most likely cause and correct solution?
⚠ Common exam trap
Candidates often assume the service name in docker-compose.yml always matches the DNS hostname, but CompTIA tests the nuance that `container_name` overrides the default hostname, causing DNS resolution failures even when containers are on the same network.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The frontend container is trying to resolve 'backend-service' but the backend container's hostname is different because the container_name is set in the docker-compose.yml.
The frontend container is attempting to resolve 'backend-service' via Docker's embedded DNS, but the backend container's hostname may differ if the `container_name` directive is set in the docker-compose.yml. Docker Compose creates a default hostname equal to the service name unless overridden by `container_name`. If `container_name` is set to something like 'my-backend', the DNS entry for 'backend-service' will not exist, causing an `EAI_AGAIN` (temporary failure in name resolution) error. The solution is to either use the correct hostname (the service name) or set `container_name` to match the expected hostname.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The frontend container is trying to resolve 'backend-service' but the backend container's hostname is different because the container_name is set in the docker-compose.yml.
Why this is correct
If container_name is set, the service name is not used as the hostname; the frontend should use the container_name.
- ✗
The containers are not on the same network because the default network driver is 'host' instead of 'bridge'.
Why it's wrong here
The default network driver is bridge, and the problem states they are on the same custom bridge network.
- ✗
The backend service is listening on a different port than expected.
Why it's wrong here
The logs show a DNS resolution error, not a connection refused error.
- ✗
The Docker DNS resolver is caching an old IP address for the backend service.
Why it's wrong here
Docker's embedded DNS does not cache stale entries in this manner.
Visual reference
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
DNS
DNS is the system that translates human-friendly domain names like example.com into machine-readable IP addresses so computers can find each other on a network.
Key term
Linux
Linux is an open-source operating system that manages computer hardware and software, widely used in servers, desktops, and embedded systems.
About these practice questions
One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.