Delivery & cloudInterview preparation
Intermediate·Scenario·2 min read

The app cannot reach the database container. What should I check?

Practice this question

Definition:

Each container has its own network context, so localhost points back to that container rather than a sibling service. Reaching a database requires the correct address, network path, credentials and an accepting database process. Compose startup order can start a process without guaranteeing it has finished initialization.

Key points:

  • Use the database service name, not localhost, between containers.

  • Check shared networks, ports, credentials and database readiness.

  • Startup order alone does not guarantee the database is ready to accept queries.

  • Use bounded connection retries or readiness coordination, and confirm the database listens on an interface reachable from the app.

Interview point:

  • Troubleshoot DNS, TCP reachability and login separately rather than changing credentials for a network failure.
Adapted from 09_TESTING_GIT_DOCKER_CLOUD.md · “The app cannot reach the database container. What should I check?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.