-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fuse-overlayfs: use temporary mount wrapper #3878
base: master
Are you sure you want to change the base?
fuse-overlayfs: use temporary mount wrapper #3878
Conversation
ba05b33
to
ce85cf2
Compare
There are already fuse-based snapshotters working (e.g. stargz) without this exception. Why does fuse-overlayfs require this special exception? |
I've investigated why things work for stargz and not for fuse-overlayfs. The issue occurs when using NewContainer with non-root (
So it works with stargz because it returns overlay mounts (and not fuse-based mounts). Using the fuse-overlayfs snapshotter works fine when using
Overlayfs mount use a temporary bind mounts so it can be shared (using I guess the code almost never pass a overlayfs/fuse-overlayfs immutable mount to runc, so that never happen and that why modifying But it can be reproduced with this Dockerfile:
/stage1 will be a fuse-overlayfs immutable mount from stage1, but runc can't handle it. So I'm proposing to instead do this:
|
@amurzeau Thanks for the explanation.
If we fix |
Yes, this should be enough, But I'm not sure where to put the code that create the temporary bind mount. I'm thinking about adding a folder in `util/, but there are already many folders here. Also, the temporary bind mount done in refs.go use a directory within a |
I'm not sure what alternative solutions you are suggesting. The current PR looks fine but it would be better to check |
runc (and containerd as it also uses runc) will fail to mount mounts using fuse-overlayfs. This makes tests to fail when using fuse-overlayfs snapshotter with this error: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "overlay" to rootfs at "/rw": mount overlay:/rw (via /proc/self/fd/7), data: workdir=/tmp/bktest_containerd-fuse-overlayfs-grpc312066418/root/snapshots/12/work, upperdir=/tmp/bktest_containerd-fuse-overlayfs-grpc312066418/root/snapshots/12/fs, lowerdir=/tmp/bktest_containerd-fuse-overlayfs-grpc312066418/root/snapshots/10/fs:/tmp/bktest_containerd-fuse-overlayfs-grpc312066418/root/snapshots/8/fs : no such device: unknown There are two cases handled: - When the mount is writable, it must be bind mounted by sharableMountable.Mount for the same reason than overlayfs: 2 fuse-overlayfs mounts using the same upperdir won't work (mounted dirs won't see new files created in the other mounted dir). This is what TestIntegration/TestSharedCacheMountsNoScratch checks. - When the mount is immutable, the fuse-overlayfs mount must be bind- mounted when used in a OCI spec as runc is not able to handle fuse mounts. This is what TestIntegration/TestImmutableMountFromOtherImageCheckOCISpec checks. Signed-off-by: Alexis Murzeau <[email protected]>
ce85cf2
to
676dbff
Compare
I've used LocalMounter instead of adding another new function that does bind mounts, so my questions are now irrelevant. |
I think I've resolved all remarks in the previous push, is there anything I need to improve on this PR ? |
runc (and containerd as it also uses runc it seems) will fail to mount mounts using fuse-overlayfs.
This makes tests to fail when using fuse-overlayfs snapshotter with this error:
The failing fuse-overlayfs test was discovered on PR #3876 that adds fuse-overlayfs tests.
The error can be seen here: https://github.com/moby/buildkit/actions/runs/4996865039/jobs/8950612470#step:7:1002
With this commit, fuse-overlayfs tests enabled by PR #3876 should run successfully (at least for buildkitd workflow, see https://github.com/amurzeau/buildkit/actions/runs/5009224692/jobs/8977964559)
I'm not sure why this is required as fuse-overlayfs is working outside tests.
To ensure this is not a regression from my previous PRs, I've tried to cherry-pick fuse-overlayfs test PR #3876 on top of a old commit before any of my previous merged PR and tests fails too with the same error.
Maybe the code path is not always triggered ?