buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

dns resolution issue when host has only ipv6 nameserver in /etc/resolv.conf

Open euri10 opened this issue 2 years ago • 0 comments

greetings, I had the issue after I messed up with Network Manager.

when I have this setup on my host cat /etc/resolv.conf

# Generated by NetworkManager
search home
nameserver 2a01:cb00:39e:8700:7ec1:77ff:fe02:b170

with this toto.dockerfile

FROM debian:bullseye-slim
RUN cat /etc/hosts
RUN set -eux; DEBIAN_FRONTEND=noninteractive apt-get update

then ❯ DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain docker build -f toto.dockerfile . fails, see:

#1 [internal] load build definition from toto.dockerfile
#1 sha256:e0e067e2912ddff8c8ed42d8d6987729e3e1473c52a376ad95c72c83479a1f4c
#1 transferring dockerfile: 42B done
#1 DONE 0.1s

#2 [internal] load .dockerignore
#2 sha256:b26223678f651156fd5e99bbdf3bbffb1e4fda3d38c3ff43e18647f3d8ea96eb
#2 transferring context: 2B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/debian:bullseye-slim
#3 sha256:934609b8daae60945272376631143418e3455bd8f42cec3f0749895e255e3083
#3 DONE 0.0s

#4 [1/3] FROM docker.io/library/debian:bullseye-slim
#4 sha256:8ea5e47d3721ec038de29f3a807da9338153ce2e379073a7d9124a1774b6d0a6
#4 CACHED

#5 [2/3] RUN cat /etc/hosts
#5 sha256:ce9da6e79fc46a9e96deceb7eae0113ac4422e70c6009547466bbc4089766add
#5 0.327 127.0.0.1      localhost buildkitsandbox
#5 0.327 ::1    localhost ip6-localhost ip6-loopback
#5 DONE 0.4s

#6 [3/3] RUN set -eux; DEBIAN_FRONTEND=noninteractive apt-get update
#6 sha256:2dfb6d7a8ed94bcfc86fb787c7db88daea8603215c72cf401758866832224187
#6 0.430 + DEBIAN_FRONTEND=noninteractive apt-get update
#6 0.458 Err:1 http://deb.debian.org/debian bullseye InRelease
#6 0.458   Temporary failure resolving 'deb.debian.org'
#6 0.458 Err:2 http://security.debian.org/debian-security bullseye-security InRelease
#6 0.458   Temporary failure resolving 'security.debian.org'
#6 0.459 Err:3 http://deb.debian.org/debian bullseye-updates InRelease
#6 0.459   Temporary failure resolving 'deb.debian.org'
#6 0.462 Reading package lists...
#6 0.470 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  Temporary failure resolving 'deb.debian.org'
#6 0.470 W: Failed to fetch http://security.debian.org/debian-security/dists/bullseye-security/InRelease  Temporary failure resolving 'security.debian.org'
#6 0.470 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease  Temporary failure resolving 'deb.debian.org'
#6 0.470 W: Some index files failed to download. They have been ignored, or old ones used instead.
#6 DONE 0.5s

#7 exporting to image
#7 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
#7 exporting layers
#7 exporting layers 0.1s done
#7 writing image sha256:1b9a49b615c7a5089e7d51b8e4636d007a71edb0a03b21096f3e48f58fef1333 done
#7 DONE 0.1s

while ❯ DOCKER_BUILDKIT=0 BUILDKIT_PROGRESS=plain docker build --no-cache -f toto.dockerfile . works

Sending build context to Docker daemon  62.84MB
Step 1/3 : FROM debian:bullseye-slim
 ---> abc589ebc613
Step 2/3 : RUN cat /etc/hosts
 ---> Running in 56a47af73da0
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2      56a47af73da0
Removing intermediate container 56a47af73da0
 ---> de4a0cf5a58e
Step 3/3 : RUN set -eux; DEBIAN_FRONTEND=noninteractive apt-get update
 ---> Running in 9017149f655b
+ DEBIAN_FRONTEND=noninteractive apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [161 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8182 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8545 kB in 2s (3719 kB/s)
Reading package lists...
Removing intermediate container 9017149f655b
 ---> 9a49001e468b
Successfully built 9a49001e468b

with now on my host ❯ cat /etc/resolv.conf buildkit works fine

# Generated by NetworkManager
search home
nameserver 8.8.8.8
nameserver 4.4.4.4
nameserver 2a01:cb00:39e:8700:7ec1:77ff:fe02:b170

euri10 avatar Jun 29 '22 06:06 euri10