From b5dc96438abd1f311f2f2010610c1d1b683ddd8f Mon Sep 17 00:00:00 2001 From: Frank Felhoffer Date: Wed, 22 Apr 2020 15:58:46 -0400 Subject: [PATCH 1/2] 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 --- images/orderer/Dockerfile | 4 ++++ images/peer/Dockerfile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/images/orderer/Dockerfile b/images/orderer/Dockerfile index 549464a1d00..1ca6adf0ffe 100644 --- a/images/orderer/Dockerfile +++ b/images/orderer/Dockerfile @@ -6,6 +6,10 @@ ARG GO_VER ARG ALPINE_VER FROM alpine:${ALPINE_VER} as base RUN apk add --no-cache tzdata +# set up nsswitch.conf for Go's "netgo" implementation +# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275 +# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf +RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf FROM golang:${GO_VER}-alpine${ALPINE_VER} as golang RUN apk add --no-cache \ diff --git a/images/peer/Dockerfile b/images/peer/Dockerfile index 19ce9140009..18a4c74e523 100644 --- a/images/peer/Dockerfile +++ b/images/peer/Dockerfile @@ -7,6 +7,10 @@ ARG ALPINE_VER FROM alpine:${ALPINE_VER} as peer-base RUN apk add --no-cache tzdata +# set up nsswitch.conf for Go's "netgo" implementation +# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275 +# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf +RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf FROM golang:${GO_VER}-alpine${ALPINE_VER} as golang RUN apk add --no-cache \ From 115a38360b1a5ca99a35603cd91a9f1ca7f9e188 Mon Sep 17 00:00:00 2001 From: Frank Felhoffer Date: Thu, 7 May 2020 08:54:39 -0400 Subject: [PATCH 2/2] Update images/peer/Dockerfile I agree Signed-off-by: Frank Felhoffer Co-authored-by: Gari Singh --- images/peer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/peer/Dockerfile b/images/peer/Dockerfile index 18a4c74e523..5ce9da4796e 100644 --- a/images/peer/Dockerfile +++ b/images/peer/Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache tzdata # set up nsswitch.conf for Go's "netgo" implementation # - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275 # - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf -RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf +RUN echo 'hosts: files dns' > /etc/nsswitch.conf FROM golang:${GO_VER}-alpine${ALPINE_VER} as golang RUN apk add --no-cache \