Courseiva
mediumMultiple ChoiceObjective-mapped

XK0-006 Practice Question: Managing a containerized microservices…

You are managing a containerized microservices environment using Podman. One of the services needs to access a PostgreSQL database running in a separate container. The database container is named 'db' and uses the default bridge network. The application container is launched with the command: podman run -d --name app --network host myapp. The application fails to connect to the database using the hostname 'db'. Which change should you resolve the issue?

⚠ Common exam trap

CompTIA often tests the misconception that the default bridge network supports automatic DNS resolution by container name, when in reality only user-defined networks provide that feature in both Podman and Docker.

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

Use a user-defined network and connect both containers

The default bridge network in Podman does not provide automatic DNS resolution between containers by name. When the app container uses `--network host`, it shares the host's network stack and is not connected to any container network, so it cannot resolve the container name 'db'. A user-defined network enables built-in DNS resolution, allowing containers to communicate by name. Connecting both containers to the same user-defined network resolves the connectivity issue.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use a user-defined network and connect both containers

    Why this is correct

    A user-defined network provides automatic DNS resolution, allowing 'db' to resolve to the database container.

  • Use --link db:db when running app container

    Why it's wrong here

    --link is deprecated and may not work with remote Podman or newer versions; user-defined networks are preferred.

  • Set environment variable DB_HOST=localhost

    Why it's wrong here

    localhost inside the host-network container refers to the host itself, not the database container.

  • Run app container on the same network as db using --network bridge

    Why it's wrong here

    The default bridge network does not provide DNS resolution; containers can only communicate via IP addresses.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

Courseiva writes every XK0-006 question from scratch — 979 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.