Looks like Go resolver uses /etc/nsswitch.conf, but busybox base image doesn't include them:
# docker run -ti --rm --env NGINX_STATUS="http://localhost/status/format/json" --entrypoint=sh sophos/nginx-vts-exporter
/ # cat /etc/nsswitch.conf
cat: can't open '/etc/nsswitch.conf': No such file or directory
In this case resolver uses DNS first and ever "localhost" resolves via external DNS.
It isn't expected behaviour because other busybox utilities uses /etc/host for resolving.
Hello!
Looks like Go resolver uses
/etc/nsswitch.conf
, but busybox base image doesn't include them:In this case resolver uses DNS first and ever "localhost" resolves via external DNS.
It isn't expected behaviour because other busybox utilities uses /etc/host for resolving.