Back to the blog Self-hosting

Can Your Dockerized App Resolve Its Dependencies? A DNS Readiness Checklist

A successful lookup on the host does not prove an application container can resolve its dependencies. Test DNS from the workload’s actual network context, distinguish lookup failures from connection problems, and check how the app responds when DNS is slow or unavailable.

An operator checking DNS resolution from a Docker application container and its connected services

Start with the names the application needs

Before changing DNS settings, write down the names the application actually resolves. A Dockerized business or AI application may depend on internal services such as a database, cache or queue, as well as external endpoints used for APIs or other integrations. Include names used by background workers and scheduled jobs, not just the web-facing process.

For each dependency, record the hostname the application uses, whether it is internal or external, which workload needs it, and how you know the lookup and connection work. Record the expected port or protocol where relevant; a name resolving correctly does not establish that the destination accepts connections.

  • Internal service names, including database and supporting services.
  • External hostnames the workload contacts during normal operation.
  • Which container or process needs each name, and whether it uses a short name or a fully qualified name.
  • What a successful lookup and a successful connection look like for that dependency.

Treat each network context as a separate test

A hostname can resolve on the Docker host and fail inside a container. The host and container may use different resolver configuration, and Docker network membership affects whether internal service names are discoverable. Test from the context that is failing rather than treating a host lookup as proof that the workload is configured correctly.

Start with the names the application needs

Test resolution from the host, container and application

Run a lookup from the host first to establish a baseline, then repeat it inside the relevant container. For example, inspect the container’s resolver configuration with docker exec <container> cat /etc/resolv.conf and try a system name-service lookup with docker exec <container> getent hosts <hostname>. These commands require the relevant utilities to be present in the container; minimal images may not include them.

For a Compose service, docker compose exec <service> getent hosts <hostname> can test from that service’s container. If the application container lacks diagnostic tools, use a suitable diagnostic method that shares its Docker network, but treat that as a network-level check rather than proof that the application uses identical resolver settings or code paths.

Where available, compare getent with dig. getent follows the system name-service path used by many applications; dig queries DNS directly. A difference between them can help narrow down whether the issue is in DNS itself or in the system’s configured name-resolution path.

Finally, test through the application’s own behavior. Check its logs, health checks or a safe operation that exercises the dependency. Applications can use different libraries, caches or connection handling, so a successful shell lookup alone may not reproduce the application’s resolution path.

  • Host: does the name resolve from the Docker host?
  • Container: does it resolve inside the exact workload that reports the failure?
  • Application: does the real process resolve the name and proceed to the expected operation?
  • Network: is the test using the same Docker network as the workload?
Test resolution from the host, container and application

Separate DNS errors from connection failures

A name lookup and a connection are separate steps. If a lookup succeeds but the application cannot reach the destination, investigate the next layer: the destination port, service availability, network access, firewall rules or application configuration. Do not treat a resolved address as evidence that the dependency is ready.

Pay attention to the DNS response rather than recording every failure as “DNS is down.” A timeout means no usable response arrived in time; NXDOMAIN indicates that the queried name was reported as nonexistent; SERVFAIL and REFUSED are different DNS responses and point to different conditions. Capture the queried name, the response or timeout, the test location and the time of the test.

  • Lookup fails or times out: check the container’s resolver configuration, network context and DNS path.
  • Lookup succeeds, connection fails: check reachability and the destination service separately.
  • Short name fails but a fully qualified name works: inspect search domains and name construction.
  • Only one workload fails: compare its network membership and resolver settings with a working workload.

Read the failure at the right layer

Use the observed result to choose the next diagnostic step. A successful DNS lookup is not a successful application connection.

Observed resultWhat it tells youNext check
No DNS response before timeoutThe lookup did not receive a usable response in time.Check resolver configuration, reachability to the resolver and whether another configured resolver is tried.
NXDOMAINThe queried name was reported as nonexistent.Check spelling, the name being queried, search-domain behavior and whether the record should exist.
SERVFAIL or REFUSEDThe DNS server returned an error or declined the query; these are not equivalent to NXDOMAIN.Record the exact response and investigate the resolver and query context.
Name resolves, connection failsDNS returned an address, but that alone does not show that the service is reachable or available.Check the destination service, port, network access and application connection handling.

Check Docker service names and resolver settings

Internal service discovery depends on Docker network configuration. On Docker Engine, containers on the default bridge cannot refer to one another by name; containers on a user-defined network can. In Compose, services on the same default network are discoverable by service name. Services attached to separate networks do not share that network-based discovery.

Confirm that the application and the dependency are attached to a network they share, and use the service name expected by the Compose configuration. Avoid relying on a container IP as a durable identifier: when a Compose service is recreated, its IP can change while its service name remains stable.

Resolver configuration also differs by network type. Containers on Docker’s default bridge receive a copy of the host resolver configuration. Containers on a custom network use Docker’s embedded DNS server at 127.0.0.11, which forwards external lookups to upstream DNS servers. Inspect the configuration in the affected container rather than assuming the host’s settings apply.

Check whether the workload uses a short name or a fully qualified name. Docker can configure DNS servers per container, and --dns-search sets search domains for non-fully-qualified names. Search domains and the ndots setting can affect which queries are tried; an absolute name ending in a dot bypasses the search list. Verify the actual name and settings before changing them.

  • Are the application and internal dependency attached to a shared Docker network?
  • Is the application querying the Compose service name rather than an assumed IP address?
  • Does the container’s resolver configuration match the network type and intended DNS setup?
  • Could a short hostname, search domain or ndots behavior be changing the query?

Test behavior when DNS is slow, unavailable or recovering

A deployment that works during a healthy lookup has not necessarily been tested against a slow resolver. If the first configured resolver is unresponsive, a lookup may wait before trying another server. That delay can make an application appear slow even if a later resolver can answer.

In a controlled test environment, check how the workload behaves when its configured DNS path is delayed or unavailable. Observe whether requests fail clearly, wait for a long time, or recover when DNS becomes available again. Keep the test isolated from production dependencies unless you have an approved procedure for testing there.

Also test recovery, not just failure. When a Compose service is recreated, its IP can change while its name remains the same. A client with an open connection to the old container needs to detect the closed connection, resolve the name again and reconnect. Verify that the application’s connection handling does this rather than assuming an existing connection will move to the replacement.

Caching can obscure the result in either direction. A cached successful answer may make an upstream DNS problem appear healthy. A cached negative answer may continue to make a newly created name appear absent until the negative TTL expires. Record whether the test may have used a cached answer and repeat checks in a way that distinguishes cache behavior from current resolver health.

  • Measure the application’s observed behavior when DNS is slow, not only whether a command eventually returns an answer.
  • Check whether a failed request can recover after DNS service returns.
  • Verify that the client detects a closed connection, looks up the service name again and reconnects.
  • Consider both positive and negative caching when a result conflicts with current DNS configuration.

Document diagnostics and make the deployment checklist actionable

A useful DNS runbook preserves enough context for someone else to reproduce the issue. Record the hostname as queried, whether it is internal or external, the failing workload, its Docker network, the resolver configuration, the command or application operation used, and the exact result. Include whether a connection test followed the lookup and whether the result may have been cached.

For managed Docker hosting, DNS checks and infrastructure management can help with the surrounding deployment, but operators should still establish what those checks cover and how each application dependency behaves from its own network context. Airbip runs application instances as Docker workloads and includes DNS checks, service lifecycle management and configurable backups; those capabilities do not remove the need to understand application dependencies, access and recovery choices.

  • List internal and external DNS dependencies and the workloads that use them.
  • Record the intended Docker network and the name each workload should query.
  • Keep a host, container and application-level test for important dependencies.
  • Capture exact DNS outcomes and test connectivity as a separate step.
  • Test slow or unavailable DNS and recovery in a controlled environment.
  • Document how the application handles recreated services, changed addresses and closed connections.
  • Review the runbook after changing network membership, resolver settings or dependency names.

Frequently asked questions

If DNS works on the Docker host, why might it fail in a container?

The host and container may use different resolver configuration, and internal name discovery depends on the container’s Docker network. Test from the affected container and, where possible, through the application itself.

Can I use a container IP instead of a Compose service name?

An IP may work temporarily, but it is not a durable substitute for a service name: a recreated Compose container can receive a different IP while its service name remains stable. Clients need to handle closed connections, resolve the name again and reconnect.

What is the difference between getent and dig?

getent follows the system name-service path used by many applications, while dig queries DNS directly. They can produce different results, so comparing them can help distinguish a direct DNS response from behavior in the system’s configured resolution path.

Does a successful DNS lookup prove that a dependency is available?

No. It confirms that a name lookup returned an address, not that the destination is reachable or accepting connections. Test DNS and the application’s connection to the dependency as separate steps.

Sources and further reading 3