-
Notifications
You must be signed in to change notification settings - Fork 802
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
Bind mounts in RUN
statements are not propagating changes to their source correctly
#5951
Comments
Hi @solacelost , I think it happens because buildah reused previous layer and this PR which merged recently should fix it #5691 Could you try the code from upstream ? |
The issue that I'm seeing is that the files actually do not change at all in the bind source, not that there's some invalid cache being used. Is buildah caching the bind-mounted directory, and only propagating those changes back to the source in the event of a change? That seems unexpected, compared to how a bind mount works on a running container instance. |
Freshly compiled
Edited to provide more version information |
I'll take a look at this issue. |
Some additional context to show the kinds of things this will impact: |
@solacelost Okay my bad i misread the original post. I think this is expected behavior If you want changes on |
That is not true. A bind mount should not be a transient volume, it should be a bind mount of a directory from the host into the runtime. Setting it to |
Here, I've gone and recompiled 1.37.5 to demonstrate.
This is the intended, functional behavior. It's almost as if in the current release buildah is using an overlayfs on top of my bind mount and preventing the changes from reaching the host filesystem, as they're supposed to. |
To make sure that we're clear here, I do not expect the container image layer to contain |
I went to go find an exact reference to this behavior, since I and others have been relying on it for a while. I couldn't find any clarity in the existing
So... that would be in line with the It looks like a multi-stage build will be physically impossible with an intermediate OCI archive for rpm-ostree composes, then? |
@solacelost Yes buildah should behave like |
The overlay option flag won't persist the changes to the host source, though, will it? It's my understanding that using Perhaps a new flag would be appropriate, or we can simply move away from multi-stage Containerfiles for all-in-one rpm-ostree composes and move to a multi-phased approach instead. I've already done so, since this change, with one Containerfile creating the OCI archive and then a pipeline-driven step to extract it from the image before using the archive in I'm going to see what @cgwalters thinks :) |
That's what's done in https://gitlab.com/fedora/bootc/base-images/-/blob/main/Containerfile?ref_type=heads and since it sounds like you're doing custom builds, be sure to track https://gitlab.com/fedora/bootc/tracker/-/issues/32 |
The way it's working in that Containerfile will no longer work, as it doesn't modify the host filesystem in the bind mount to If you look at my reproducer Containerfile and the difference in behavior between 1.38.1 and 1.37.5 (and many earlier versions), you can see that it will break the workflow used to compose bootc bases. You can try it on a fully updated Fedora 41 system to see 1.38.1 in action. |
@solacelost |
I believe this is a duplicate of #5952 (it was filed earlier, but there's a lot more in that issue). |
The discarding behavior should only be affecting locations mounted with |
I have observed strange behavior lately with bind mounts misbehaving in RUN statements and it's causing major issues with some of my workflows. I created a minimal reproducer to highlight the issue.
Within the layer where the bind mount is occurring, the changes are saved. After that layer, including outside the container at all as well as any follow-on layers that re-mount the bind mount, the changes are not propagated at all.
I tried to track down the cause, but rapidly ran out of my depth of understanding for how buildah handles bind mounts.
podman info
output:The text was updated successfully, but these errors were encountered: