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.
This commit is contained in:
Luke Kysow
2018-07-24 16:42:10 +02:00
parent 29463a6330
commit 465b65ec0a

View File

@@ -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