containers / build

another build tool for container images (archived, see https://github.com/rkt/rkt/issues/4024)
Apache License 2.0
342 stars 80 forks source link

Handle host /etc/resolv.conf being a symlink #293

Closed tjdett closed 7 years ago

tjdett commented 7 years ago

/etc/resolv.conf can be a symlink (eg. Fedora 25), but the symlink likely won't resolve inside the chroot. Copy /etc/resolv.conf as regular file instead.

Previous behaviour:

$ sudo "PATH=$(pwd)/bin:$PATH" bin/acbuild begin --debug ./library-alpine-3.5.aci
Beginning build with ./library-alpine-3.5.aci
$ sudo "PATH=$(pwd)/bin:$PATH" bin/acbuild run --engine chroot -- \
  sh -c 'ls -la /etc/resolv.conf && cat /etc/resolv.conf'
lrwxrwxrwx    1 root     root            35 Mar  7 22:22 /etc/resolv.conf -> /var/run/NetworkManager/resolv.conf
cat: can't open '/etc/resolv.conf': No such file or directory

New behaviour:

$ sudo "PATH=$(pwd)/bin:$PATH" bin/acbuild run --engine chroot -- \
  sh -c 'ls -la /etc/resolv.conf && cat /etc/resolv.conf'
-rw-r--r--    1 root     root           123 Mar  9 01:01 /etc/resolv.conf
# Generated by NetworkManager
...
cgonyeo commented 7 years ago

Awesome, thanks for the PR!