Skip to content

Commit 2c762d0

Browse files
authored
Merge pull request #84 from infosiftr/nsswitch.conf
Add bare-bones "/etc/nsswitch.conf" for "netgo" to know it should check "/etc/hosts" before doing DNS lookups
2 parents 8ada62f + 454a0ff commit 2c762d0

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

17.06/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ FROM alpine:3.6
33
RUN apk add --no-cache \
44
ca-certificates
55

6+
# set up nsswitch.conf for Go's "netgo" implementation (which Docker explicitly uses)
7+
# - https://github.com/docker/docker-ce/blob/v17.09.0-ce/components/engine/hack/make.sh#L149
8+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
9+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
10+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
11+
612
ENV DOCKER_CHANNEL stable
713
ENV DOCKER_VERSION 17.06.2-ce
814
# TODO ENV DOCKER_SHA256

17.07/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ FROM alpine:3.6
33
RUN apk add --no-cache \
44
ca-certificates
55

6+
# set up nsswitch.conf for Go's "netgo" implementation (which Docker explicitly uses)
7+
# - https://github.com/docker/docker-ce/blob/v17.09.0-ce/components/engine/hack/make.sh#L149
8+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
9+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
10+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
11+
612
ENV DOCKER_CHANNEL edge
713
ENV DOCKER_VERSION 17.07.0-ce
814
# TODO ENV DOCKER_SHA256

17.09/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ FROM alpine:3.6
33
RUN apk add --no-cache \
44
ca-certificates
55

6+
# set up nsswitch.conf for Go's "netgo" implementation (which Docker explicitly uses)
7+
# - https://github.com/docker/docker-ce/blob/v17.09.0-ce/components/engine/hack/make.sh#L149
8+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
9+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
10+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
11+
612
ENV DOCKER_CHANNEL stable
713
ENV DOCKER_VERSION 17.09.0-ce
814
# TODO ENV DOCKER_SHA256

17.10-rc/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ FROM alpine:3.6
33
RUN apk add --no-cache \
44
ca-certificates
55

6+
# set up nsswitch.conf for Go's "netgo" implementation (which Docker explicitly uses)
7+
# - https://github.com/docker/docker-ce/blob/v17.09.0-ce/components/engine/hack/make.sh#L149
8+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
9+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
10+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
11+
612
ENV DOCKER_CHANNEL test
713
ENV DOCKER_VERSION 17.10.0-ce-rc1
814
# TODO ENV DOCKER_SHA256

Dockerfile.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ FROM alpine:%%ALPINE-VERSION%%
33
RUN apk add --no-cache \
44
ca-certificates
55

6+
# set up nsswitch.conf for Go's "netgo" implementation (which Docker explicitly uses)
7+
# - https://github.com/docker/docker-ce/blob/v17.09.0-ce/components/engine/hack/make.sh#L149
8+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
9+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
10+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
11+
612
ENV DOCKER_CHANNEL %%DOCKER-CHANNEL%%
713
ENV DOCKER_VERSION %%DOCKER-VERSION%%
814
# TODO ENV DOCKER_SHA256

0 commit comments

Comments
 (0)