Dockerfile.rootfs: drop dangling /etc/resolv.conf symlink#205
Open
maxskokov wants to merge 1 commit into
Open
Conversation
The rootfs image ships /etc/resolv.conf as a symlink to /tmp/resolv.conf. In a build context /tmp is empty, so the symlink dangles and older buildkit fails any RUN step on the image with: make mountpoint "/etc/resolv.conf": file exists when it tries to bind-mount the build-time resolv.conf over it. Docker injects its own /etc/resolv.conf at runtime regardless, so the shipped symlink serves no purpose in the container image. Remove it in the builder stage before it is copied into the final scratch image. Verified with `docker save` that no layer contains etc/resolv.conf after the change, and that DNS still resolves at runtime via Docker's mounted resolv.conf (nslookup downloads.openwrt.org succeeds). Fixes: openwrt#191 Signed-off-by: Maxim Skokov <skokov.m020709@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/etc/resolv.confin the rootfs image is a symlink to/tmp/resolv.conf. Ina build context
/tmpis empty, so the symlink dangles and older buildkitfails any
RUNon the image with:while trying to bind-mount the build-time resolv.conf over it, which makes
FROM openwrt/rootfs+ anyRUNunusable as a base image (#191). Dockerinjects its own
/etc/resolv.confat runtime anyway, so the shipped symlinkis useless in the container image.
Removed in the builder stage before the rootfs is copied into the final
scratchimage, so real firmware (where the symlink is intentional) isuntouched.
Verification
docker saveof the rebuilt image: no layer containsetc/resolv.conf(before:
lrwxrwxrwx etc/resolv.conf -> /tmp/resolv.conf).nslookup downloads.openwrt.orgresolves viaDocker's mounted resolv.conf.
longer reproduces, so it was fixed upstream in buildkit at some point and
the reporter hit it on an older version. The dangling symlink is still
shipped though and breaks older buildkit for no benefit, so removing it is
worthwhile and side-effect-free.
Fixes #191