Links don't result in /etc/hosts update

I have a legacy app, that is now running in Docker. Setting up links in the docker-compose file works well, but does not seem to work in Rancher. I suspect the app is looking in /etc/hosts directly, or for some other reason needs /etc/hosts updated with the link to IP mappings.

I know the linked services are discoverable in Rancher, but I really don’t want to ask people to change their code “for Rancher”. Is there a way to tell rancher-compose to behave like Docker Compose in this intance? All of the containers are running on the same host, btw. And the stack comes up and runs fine using Docker Compose.

Short answer: no.

We run a DNS server because managing /etc/hosts entries for hundreds of possible things, and updating them in every container when they change is impractical and error-prone. Docker has had repeated issues corrupting the hosts file trying to do stuff like this, and they want to deprecate it entirely themselves so your app will break eventually in native docker.

I know it’s unfortunate to have to change code, but "use gethostbyname(3)" isn’t exactly what I would call writing code “for Rancher”.