-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerTools buildImage's contents (and config) nukes the prior layer's files for linked directories #240919
Comments
When You might work around this problem by installing packages manually using I've previously made an effort in this direction Sometimes I clean up and forward-port a commit or idea from there, but this project really needs more than just me to make some real progress. |
@roberth Yes, that turns out to be the exact issue. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/building-on-dockerfile-based-images/29583/18 |
At least in case of Debian starting image I was able to fix this with minimal changes by using the following copyToRoot = pkgs.buildEnv {
name = "wasmcloud";
extraPrefix = "/usr"; # /bin is a symlink to /usr/bin on Debian, add a prefix to avoid replacing original `/bin`
paths = [
bin # the binary with a `$out/bin/wasmcloud`
pkgs.dockerTools.caCertificates
];
postBuild = ''
mv $out/usr/etc $out/etc
''; This merged the binary in |
Describe the bug
If you use buildImage with a base image (
fromImage
) and define a non-empty contents such ascontents = [ pkgs.gnumake ]
, then the base image's/bin
or other linked paths will not be available in the final image.Steps To Reproduce
Thread: https://discourse.nixos.org/t/building-on-dockerfile-based-images/29583/10
Consider this file:
Build it an look at the
/bin
directory, which should have > 100 files if it had all the base image (Ubuntu) files:Just the one
make
file provided by the pkgs.gnumake contents. The story is the same if we usecopyToRoot
(see above-linked thread).Expected behavior
The semantics are surprising and quite likely a bug. Most people seem to expect the extra packages to be linked or copied into the target directories (i.e.
/bin
) and the prior files provided by the base image (ubuntu) to remain available.nix-env --version
outputThe text was updated successfully, but these errors were encountered: