From 465b65ec0a49ee7984d91c49ffeb90dd78c4284a Mon Sep 17 00:00:00 2001 From: Luke Kysow Date: Tue, 24 Jul 2018 16:42:10 +0200 Subject: [PATCH] Add file so /etc/hosts works in Docker. If users are using /etc/hosts then because CGO is disabled golang doesn't look at that file. This fix makes it so /etc/hosts is respected. --- Dockerfile-base | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile-base b/Dockerfile-base index d6b80f688..5ab29ff84 100644 --- a/Dockerfile-base +++ b/Dockerfile-base @@ -34,3 +34,7 @@ RUN apk add --no-cache ca-certificates gnupg curl git unzip bash openssh libcap rm -rf /tmp/build && \ apk del gnupg openssl && \ rm -rf /root/.gnupg && rm -rf /var/cache/apk/* + +# set up nsswitch.conf for Go's "netgo" implementation +# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275 +RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf