-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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.buildLayeredImage truncates oversized closures #78744
Labels
0.kind: bug
Something is broken
Comments
Oh, I see. It passes multiple paths to the script when there are more than max layers. I didn't realize that. Should be a relatively simple fix. |
BTW, I'm super sorry I introduced this problem. |
10 tasks
purefn
pushed a commit
to Simspace/nixpkgs
that referenced
this issue
Jan 29, 2020
Fixes NixOS#78744 My previous change broke when there are more packages than the maximum number of layers. I had assumed that the `store-path-to-layer.sh` was only ever passed a single store path, but that is not the case if there are multiple packages going into the final layer. To fix this, we loop through the paths going into the final layer, appending them to the tar file and making sure they end up at the right path.
No worries! I appreciate the quick turnaround. |
I'm also feeling guilty... 🤦♂️ |
nlewo
pushed a commit
to nlewo/nixpkgs
that referenced
this issue
Jan 30, 2020
Fixes NixOS#78744 My previous change broke when there are more packages than the maximum number of layers. I had assumed that the `store-path-to-layer.sh` was only ever passed a single store path, but that is not the case if there are multiple packages going into the final layer. To fix this, we loop through the paths going into the final layer, appending them to the tar file and making sure they end up at the right path.
nlewo
added a commit
to nlewo/nixpkgs
that referenced
this issue
Jan 30, 2020
A regression test for NixOS#78744.
just bumping, it's been 2 weeks |
roberth
pushed a commit
to hercules-ci/nixpkgs
that referenced
this issue
Mar 16, 2020
Fixes NixOS#78744 My previous change broke when there are more packages than the maximum number of layers. I had assumed that the `store-path-to-layer.sh` was only ever passed a single store path, but that is not the case if there are multiple packages going into the final layer. To fix this, we loop through the paths going into the final layer, appending them to the tar file and making sure they end up at the right path.
10 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When building a Docker image with
dockerTools.buildLayeredImage
, if the closure ofcontents
has too many store paths, some will be ignored and not packed in the final image. I discovered this by packagingphantomjs2
into an image, but there's a shorter reproduction below.To Reproduce
nix-build
the following expression:$ docker load <result
docker run --rm -i test
Note that the container crashes because it can't find the PhantomJS binary on the filesystem.
Expected behavior
The container should drop into a
phantomjs
REPL.Additional context
I believe that this issue is caused by 3be7675. The script to create the layered image no longer accounts for multiple arguments, which would explain the symptom I saw above. Ultimately, by ignoring the extra arguments, only some of the final layer's contents are found.
To test this hypothesis, I was able to create a test case that bypasses
buildLayeredImage
and directly usesmkManyPureLayers
.First, the Nix expression:
There are three points of interest:
We create 5 dummy derivations that are
symlinkJoin
-friendly. Really, they're just directories with a plain text file.We set
maxLayers
to 3 - this ensures that we should be getting one layer with 3 derivations.At the bottom, we create the layers derivation.
When I build this, here is what I see:
Notice that we have lost the
text-4
andtext-5
derivations - they should have been inresult/3/layer.tar
, but aren't.To confirm, I tested this exact expression against nixpkgs at the parent commit (ad7c7cf), and got this result:
Note that the derivations
text-3
,text-4
, andtext-5
are all properly in the final layer as expected.Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result."x86_64-linux"
Linux 5.3.0-7625-generic, Pop!_OS, 19.10
no
yes
nix-env (Nix) 2.3.1
"nixpkgs-20.03pre210728.42a195919a1"
/home/user/.nix-defexpr/channels/nixpkgs
Maintainer information:
The text was updated successfully, but these errors were encountered: