Skip to content

Commit b5dc964

Browse files
committed
Add nsswitch.conf to the orderer and peer docker images
Go's netgo implementation currently does not respect hostname overrides defined in /etc/hosts if the /etc/nsswitch.conf does not exists. Signed-off-by: Frank Felhoffer <[email protected]>
1 parent 8e23e6d commit b5dc964

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

images/orderer/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ARG GO_VER
66
ARG ALPINE_VER
77
FROM alpine:${ALPINE_VER} as base
88
RUN apk add --no-cache tzdata
9+
# set up nsswitch.conf for Go's "netgo" implementation
10+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
11+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
12+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
913

1014
FROM golang:${GO_VER}-alpine${ALPINE_VER} as golang
1115
RUN apk add --no-cache \

images/peer/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ ARG ALPINE_VER
77

88
FROM alpine:${ALPINE_VER} as peer-base
99
RUN apk add --no-cache tzdata
10+
# set up nsswitch.conf for Go's "netgo" implementation
11+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
12+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
13+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
1014

1115
FROM golang:${GO_VER}-alpine${ALPINE_VER} as golang
1216
RUN apk add --no-cache \

0 commit comments

Comments
 (0)