Skip to content

Commit ce7706d

Browse files
committed
Dockerfile: add nsswitch.conf so go resolver uses /etc/hosts first
go upstream might fix this soon, but for now it is rather surprising see golang/go#35305
1 parent 58f65c0 commit ce7706d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ EXPOSE 4150 4151 4160 4161 4170 4171
1616
RUN mkdir -p /data
1717
WORKDIR /data
1818

19+
# set up nsswitch.conf for Go's "netgo" implementation
20+
# https://github.com/golang/go/issues/35305
21+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
22+
1923
# Optional volumes (explicitly configure with "docker run -v ...")
2024
# /data - used by nsqd for persistent storage across restarts
2125
# /etc/ssl/certs - for SSL Root CA certificates from host

0 commit comments

Comments
 (0)