The core of the problem lies in DNS resolution within Docker’s internal network. Normally, Docker handles DNS resolution for container names, allowing containers to communicate using these names. However, specific configurations can disrupt this, such as:
- Disabling the systemD resolver.
- Conflicts introduced by NginXManager.
The symptom? An Nginx container failing to resolve other container names, defaulting to an external DNS server (like 188.8.131.52).
Ensure all containers are on the same Docker network. This can be a default bridge network or a custom network. Create and attach your containers to this network for internal name resolution.
docker network create my-network docker run --network=my-network my-container
Nginx may need a specific resolver for internal DNS queries. Docker assigns a DNS server for internal networks, which you can find by inspecting the Docker network:
docker network inspect my-network
Use this IP in your Nginx configuration:
Since you’ve disabled the systemD resolver, ensure it’s not affecting Docker’s DNS service. Check if Docker’s internal DNS is operational and not overridden.
Ensure NginXManager isn’t inadvertently altering DNS settings. It should be configured to work harmoniously with Docker’s networking.
After making these changes, test by pinging containers by name from within the Nginx container. If set up correctly, this should now resolve correctly.