-
Notifications
You must be signed in to change notification settings - Fork 2.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
allow to enforce platform checks when looking up local/pulling images #12682
Comments
Thanks for taking the time to open the issue. Yes, Docker does not have this issue as Docker does not support running multi-arch containers. |
Mmmh, this is indeed very counter intuitive. Given that on my account, I am run many scripts from many projects that eventually start a container, and since I tend to use fedora by default in a lot of my projects, it means that to be shielded by this I shall add --arch $(uname -m) in pretty much all my "podman/docker run" command in all my projects, I don't find this super user friendly. However I just checked (since you said Docker can't run multi arch containers), actually:
Ok, l accept the answer, but honestly I find this behavior strange (though I understand you did not code it because you liked it, but to fix wrong multi-arch image). |
Thanks for your understanding, @Romain-Geissler-1A! Also thanks for correcting, I was entirely unaware that Docker is supporting it as well. Would a WARNING as emitted by Docker be more user friendly in your eyes? I totally sympathize that it's not ideal for you use case but I think that our hands are tied given that so many images don't get the architecture right. |
Yes I consider that the warning that docker emits is welcome in understanding a bit more what's wrong. I would personally add in this warning message something mentioning that either you shall explicitly provide an arch (what docker reads already), or somehow re-pull/change the pull policy to always pull, since both can fix the issue. And from now on internally in Amadeus, since we are about to migrate partially our workloads to arm, I will do some internal advocacy so that people ALWAYS define an explicit --arch from now on in all their podman/docker command (and somehow I need to implement #12680 so that people can easily use "--arch |
@Romain-Geissler-1A, maybe I can give you more. How about a new option in @rhatdan PTAL ... mutli-arch is hard and I think we should continue doing what we're doing BUT an option can be a nice compromise if users know what they're doining. |
@Romain-Geissler-1A, I reopened the issue and turned it into a feature request. |
Ah, guess what. I wanted to have a look if the latest buildah accepts --arch aarch64 already (since the buildah doc somehow seems to mention this), I decided to build https://github.com/containers/buildah/blob/main/contrib/buildahimage/upstream/Dockerfile to have a quick look, and ran: podman build https://github.com/containers/buildah/raw/main/contrib/buildahimage/upstream/Dockerfile It looked very slow, I checked why, and actually it was using the aarch64 fedora instead of the x86 one ! I was hit by mistake by the very issue I reported one hour ago :D |
Just throwing here some random ideas. Do you have a way to store in the local image cache what was the full collection of variants offered by a given image name ? Typically, for an image that has only a single variant, even different from the host one (for example an arm image I have just built locally), podman/docker shall always attempt to run it with that unique arch if no --arch flag was provided on the command line. On the other side, an image that you know has several variants, among which one of them matches the host, should result in podman/docker trying to run that host arch if no --arch was provided. And finally in the case of an image with several variants, but none of them matching the host, podman/docker can stick the the existing behavior: run the variant that was latest pulled in the image cache. But all this relies on the fact that you get informations about the manifest.list for images you pulled locally already, and I am not sure this is the case with your current storage mechanism. |
The information if a given image has multiple variants is not generally available since images can also be pulled directly by digest which will pull the image directly without looking at the manifest list (Docker) or image index (OCI). Assuming we had such information, I would still be extremely careful since images may change on the source registry. I think the core of the problem is that
Would that help your organization? Enforcing platform checks would work assuming all your images get things right. |
If such a strict option existed, yes I would definitely reach the people in charge of the developer VM management to customize our podman installation with this stricter option enabled in /etc/containers/containers.conf. In case of podman remote, I am not sure if the client side /etc/containers/containers.conf would be read, or the server side /etc/containers/containers.conf. However, since I see we are doing more and more podman in podman/docker scenarios (since we are basically still stuck with only docker daemon in our CI for now, at whole company level), it means many people will install podman themselves, and so would be unlikely to enable this stricter option. I don't know what is the amount of wrong image in the wild, but usually when I have to make such a decision for users of my software, I try to favor the legit users rather than the ones running non valid cases (like the ones having multi arch image with wrong arch). So, if the impact is acceptable (which I can't judge myself), I would rather make the strict behavior of podman the default one, and advocate the ones having invalid images to use an opt-in option to lower the checks run by podman. |
Thanks!
It's hard to back it with numbers but I prefer portability and compatibility (to Docker) over strict checks. Strict platform checks bit us too many times, even the official Kubernetes pause image didn't get the architectures right for a long period of times. |
I am fine with adding a strict check, I even think it is a good idea. Maybe at some point in the distant future we could turn it on by default. |
A friendly reminder that this issue had no activity for 30 days. |
@Romain-Geissler-1A Interested in opening a PR? |
I'm also bitten by this. The summary is that a Something that perhaps isn't clear in the report so far, is that in addition to that, the output of
Note how debian:bullseye now resolves to 0371e3756e46 (the arm64 variant), and 04fbdaf87a6a (the amd64 variant of debian:bullseye) now shows up as "", whereas before the last run, it showed up correctly as debian:bullseye From a UX perspective, I think the most intuitive would be to show both as debian:bullseye, and have another column of "ARCH" clarifying the selected architecture (perhaps hidden behind an option, or even better, only showing up if there are multiple architectures for a given image, or if the architecture is foreign to the native one). |
A friendly reminder that this issue had no activity for 30 days. |
@vrothberg Did we make any progress on this? |
No. I think we need to take a step back and discuss how we want to handle multi-arch as whole. Once we have a vision, we can check what needs to done. |
@vrothberg what should we do with this one? |
Keep it open. It's definitely something we should get done. Just needs time or priority. |
#14271 (comment) asks for the same checks but when pulling an image. |
I am assigning the issue to me to easier find it again. I did not start working on it yet, so if others want to tackle it, please free to do so and drop a comment here. |
Update, I am starting to work on this now and think that Podman should only throw a warning as Docker does, see below:
|
Yeah, a warning would be a good start to help understand what's happening. An additional flag to get a failure when the arch is wrong would be nice to have, better than grepping the command output looking for the warning. |
Check the platform when looking up images locally. When the user requested a custom platform and a local image doesn't match, the image will be discarded. Otherwise a warning will be emitted. Also refactor the code to make it more maintainable in the future. Fixes: containers/podman/issues/12682 Signed-off-by: Valentin Rothberg <[email protected]>
Check the platform when looking up images locally. When the user requested a custom platform and a local image doesn't match, the image will be discarded. Otherwise a warning will be emitted. Also refactor the code to make it more maintainable in the future. Fixes: containers/podman/issues/12682 Signed-off-by: Valentin Rothberg <[email protected]>
After pulling/creating an image of a foreign platform, Podman will happily use it when looking it up in the local storage and will not pull down the image matching the host platform. As discussed in containers#12682, the reasoning for it is Docker compatibility and the fact that user already rely on the behavior. While Podman is now emitting a warning when an image is in use not matching the local platform, the documentation was lacking that information. Fixes: containers#15300 Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg I verified that this is indeed fixed in podman 4.3.1 (using |
No it should not. |
Thanks. Filed #17063 |
/kind bug
Description
Podman seems to "remember" what was the latest --arch flag, and use it implicitly if it was not provided on the command line.
Steps to reproduce the issue:
Describe the results you received:
In the 4th step, container is run as aarch64, while it should be x86_64.
Describe the results you expected:
In the 4th step, container is run as aarch64, while it should be x86_64.
Additional information you deem important (e.g. issue happens only occasionally):
Since Red Hat doesn't provide official qemu-user-static packages, we actually did install the fedora one on RHEL 8. I know it's not covered by the Red Hat support policy, but most likely running all this on a fedora machine would yield similar results, I doubt it's related to RHEL 8, more to podman.
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
No
Additional environment details (AWS, VirtualBox, physical, etc.):
Physical x86_64 RHEL 8 machine, with qemu-user-static from fedora install on it.
The text was updated successfully, but these errors were encountered: