DEV Community

TildAlice
TildAlice

Posted on • Originally published at tildalice.io

Docker Compose DNS Fails in Prod: 4 Fixes That Work

Docker Compose worked perfectly on my laptop. Then I deployed to staging and watched services time out trying to reach each other.

The error was always the same: getaddrinfo ENOTFOUND db or curl: (6) Could not resolve host: api. Containers were running. Logs showed nothing useful. The network existed. But DNS resolution between services just... stopped working.

This isn't a beginner mistake. Docker Compose networking behaves differently across Docker Engine versions, host network configurations, and especially between Docker Desktop (which you probably use locally) and Docker Engine on a bare Linux server. The DNS resolver that "just works" on your Mac can silently fail in production for reasons that aren't obvious from the docs.

Here's what actually breaks, and the four fixes that solved it across three different production incidents.

Close-up of a person holding a Git sticker, emphasizing software development.

Photo by RealToughCandy.com on Pexels

How Docker Compose DNS Resolution Works (When It Works)


Continue reading the full article on TildAlice

Top comments (0)