From 5cf4e6d81720f2551e6a7b2b18c63d1460bbbe4e Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 28 Oct 2018 23:19:54 -0700 Subject: [PATCH] install bind-tools in Alpine base to prevent DNS failure --- godockerize.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/godockerize.go b/godockerize.go index a4e0a98..f8a9c1b 100644 --- a/godockerize.go +++ b/godockerize.go @@ -161,6 +161,14 @@ func doBuild(c *cli.Context) error { echo -e "http://dl-cdn.alpinelinux.org/alpine/%s/community\n" >> /etc/apk/repositories `, repos[i], repos[i]) } + if strings.HasPrefix(c.String("base"), "alpine") { + // IMPORTANT: Alpine by default does not come with some packages that + // are needed for working DNS to other containers on a user-defined + // Docker network. Without installing this package, nslookup and Go etc + // will fail to contact other Docker containers. + // See https://github.com/sourcegraph/deploy-sourcegraph-docker/issues/1 + install = append(install, "bind-tools") + } if len(install) != 0 { fmt.Fprintf(&dockerfile, " RUN apk add --no-cache %s\n", strings.Join(sortedStringSet(install), " ")) }