Skip to content

Commit 43f9c69

Browse files
committed
Add nsswitch.conf to Alpine images for "netgo"
1 parent 329b667 commit 43f9c69

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

1.10/alpine3.7/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
FROM alpine:3.7
22

3-
RUN apk add --no-cache ca-certificates
3+
RUN apk add --no-cache \
4+
ca-certificates
5+
6+
# set up nsswitch.conf for Go's "netgo" implementation
7+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
8+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
9+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
410

511
ENV GOLANG_VERSION 1.10.2
612

1.9/alpine3.6/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
FROM alpine:3.6
22

3-
RUN apk add --no-cache ca-certificates
3+
RUN apk add --no-cache \
4+
ca-certificates
5+
6+
# set up nsswitch.conf for Go's "netgo" implementation
7+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
8+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
9+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
410

511
ENV GOLANG_VERSION 1.9.6
612

1.9/alpine3.7/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
FROM alpine:3.7
22

3-
RUN apk add --no-cache ca-certificates
3+
RUN apk add --no-cache \
4+
ca-certificates
5+
6+
# set up nsswitch.conf for Go's "netgo" implementation
7+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
8+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
9+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
410

511
ENV GOLANG_VERSION 1.9.6
612

Dockerfile-alpine.template

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
FROM alpine:%%TAG%%
22

3-
RUN apk add --no-cache ca-certificates
3+
RUN apk add --no-cache \
4+
ca-certificates
5+
6+
# set up nsswitch.conf for Go's "netgo" implementation
7+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
8+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
9+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
410

511
ENV GOLANG_VERSION %%VERSION%%
612

0 commit comments

Comments
 (0)