[Request]: `Image save` command: platform default to current
Feature or enhancement request details
When saving an image pulled from remote sources, if the platform is nil, the save will failed with the notFound error:
For example, running
container image save alpine:latest --output /Users/itsuki/Desktop/untitled\ folder/image.tar
will give
Error: notFound: "Content with digest sha256:eafc1edb577d2e9b458664a15f23ea1c370214193226069eb22921169fc7e43f"
The digest here is not the digest for the image we are trying to save specifically, but the same for any (I think) remote images.
However, specifying the platform to be the current platform, in my case, --platform linux/arm64/v8, the save will success.
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
@0Itsuki0 and @bismansahni If this issue has not yet been resolved, we would love to work on it. We are students at UT Austin working on issues for our virtualization class. Thank you!
Hi @karenheckel it looks like @bismansahni has an open PR to make this fix, so I will work with them to close this.
@0Itsuki0 Can you confirm that the remote image was pulled with the --platform, os, and/or arch options in image pull? I'm guessing what is happening is the remote image is multi platform but only a subset of the platforms have been pulled. When we go to save the image, we try to save all the platforms and fail since those layers are not pulled.
See comment here for what the digest being used is.
Trivial repro:
% container image pull --platform linux/arm64 alpine:latest
% container image save --output image.tar alpine:latest
Error: notFound: "Content with digest sha256:85f2b723e106c34644cd5851d7e81ee87da98ac54672b29947c052a45d31dc2f"
/Users/john/Documents/sandboxes % container image save --platform linux/arm64 --output image.tar alpine:latest
alpine:latest
@bismansahni @adityaramani – It seems we have a couple options here:
- Attempt to save the current platform
- Save all platforms in the manifest that are present (right now we fail I think because the manifest is for all the platforms the actual content is sparse)
Will option 1 break if say, pull linux/amd64 and then try to image save without a matching platform?
We should also look into whether we can improve the error message for this; the current one is very developer-centric. To keep this PR focused I've created #874 for that work and we can do that in a follow-on.
@karenheckel are there any other issues that you're looking at? Let us know if you have questions about any!
@jglogan Hi, yes, my group is currently working on issues #641, #383, and the other tasks in #507 that haven't been done yet. We'll let you know if we have any questions!