This repository was archived by the owner on Sep 7, 2023. It is now read-only.
This repository was archived by the owner on Sep 7, 2023. It is now read-only.
Consul uses DNS before container's hosts file when resolving hostnames #94
Closed
Description
On Mac OS X, Consul doesn't seem to be respecting the container's hosts file when resolving hostnames.
To reproduce:
- Explicitly define a hosts file entry for container (via
--add-host
argument torun
command) for a given hostname (e.g.--add-host=my-laptop:192.168.0.7
) - In the host machine's hosts file, set the same hostname to a different IP address (e.g.
127.0.0.1 my-laptop
) - Configure health check in Consul referencing that hostname (tested with HTTP health check, pointing to something like
https://my-laptop:443/healthCheck
) - Observe that the health check fails with error
HTTP request failed: Get https://my-laptop:443/healthCheck: dial tcp 127.0.0.1:443: getsockopt: connection refused
when
Using docker exec
to run ping
or curl
against this same hostname from within the Consul container resolves to the properly configured IP address. It's only the consul
process that's resolving incorrectly. I'm not an expert on Docker, so I'm not totally sure what's going on, but it may be due to the way the consul
process is executed via the docker-entrypoint.sh
script.
Metadata
Metadata
Assignees
Labels
No labels