buildkit: Buildkit does not configure DNS correctly inside container

For a project, I enabled DOCKER_BUILDKIT="1". When building, I get wget: bad address 'my.company.com'.

The offending line is:

RUN wget http://my.company.com/foobar.txt

I am not really sure, why this does not work. Other lines like apk add --no-cache git work fine in contrast.

When experimenting, I get a similar error with:

RUN go mod download

And this works fine both on the host and when not using Buildkit.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (5 by maintainers)

Most upvoted comments

cat /etc/resolv.conf on host prints:

nameserver 127.0.0.53
options edns0

so this might be related to https://github.com/docker/libnetwork/issues/1654!?

In the container it prints:

options edns0
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844

which seems to miss the local and company DNS Servers.

Seems to fix the problem 🎉 6. Output:

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 10.79.255.100
# Too many DNS servers configured, the following entries may be ignored.
nameserver 10.79.255.200

which indicates this may be a bug in systemd resolvd (just from a quick read)

This is probably one factor. On the other hand, Buildkit IMO definitely has a bug where it handles resolv.conf different than legacy Docker (with the latter working fine).