You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.
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 to run 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.
The text was updated successfully, but these errors were encountered:
After some additional troubleshooting, it seems that this is related to the way Go's netgo DNS resolver works on Linux, and this sort of issue has cropped up in other projects. I believe I've fixed the problem. Will make a PR in a few once I do some more testing.
On Mac OS X, Consul doesn't seem to be respecting the container's hosts file when resolving hostnames.
To reproduce:
--add-host
argument torun
command) for a given hostname (e.g.--add-host=my-laptop:192.168.0.7
)127.0.0.1 my-laptop
)https://my-laptop:443/healthCheck
)HTTP request failed: Get https://my-laptop:443/healthCheck: dial tcp 127.0.0.1:443: getsockopt: connection refused
whenUsing
docker exec
to runping
orcurl
against this same hostname from within the Consul container resolves to the properly configured IP address. It's only theconsul
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 theconsul
process is executed via thedocker-entrypoint.sh
script.The text was updated successfully, but these errors were encountered: