-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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.streamLayeredImage causing overeager layer invalidation due to mtime #254421
Comments
@daniel-sampliner Thanks for the issue! So, as you deduced, that
The latter causes the sha256sum's of the layers to change (as expected). I believe your issue can be solved if we split those fields to two:
So you could set @daniel-sampliner , do you think this is a fair assessment of the problem? Would it solve your issue? |
Yeah that sounds great! I do have one "intrusive thought" nagging me: is that much flexibility needed? Instead should it be similar to the nix store which always has all files' mtime fixed at 1970-01-01? Granted, hardcoding In any case, I have no qualms with what you've suggested, since it would definitely solve my problem. |
I've pretty simple implementation here, but I don't have access to a Linux machine and I have to test first. I might spend some time next weekend, but @daniel-sampliner , if you want to you can take over the branch :). |
obe: #327579 |
Describe the bug
Changing the
created
attribute invalidates all layers of the built image.This results in lots of wasted space/bandwidth for storing/downloading the exact same contents (although with superficially different mtimes).
Steps To Reproduce
Start with simple
default.nix
:Build the old image
$(nix-build -A old) | podman image load
Build the new image
$(nix-build -A new) | podman image load
Now you can see that despite the images containing the exact same store paths, they do not share the associated layers:
Expected behavior
Images share the layers with the same store paths.
Additional context
I can patch stream_layered_image.py to apply a fixed mtime to the layers:
This has my intended effect of causing these images to share their layers, while still preserving the general image creation time in the metadata to what's specified:
However, I don't know if this has negative impacts regarding reproducability or otherwise.
Notify maintainers
@utdemir
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: