rootless: disable overlay2 if running with SELinux #42334
Merged
cpuguy83 merged 2 commits intomoby:masterfrom Jun 3, 2021
Merged
rootless: disable overlay2 if running with SELinux #42334cpuguy83 merged 2 commits intomoby:masterfrom
cpuguy83 merged 2 commits intomoby:masterfrom
Conversation
Previously, running dockerd-rootless.sh on SELinux-enabled hosts was failing with "can't open lock file /run/xtables.lock: Permission denied" error. (issue 41230). This commit avoids hitting the error by relabeling /run in the RootlessKit child. The actual /run on the parent is unaffected. https://github.com/containers/podman/blob/e6fc34b71aa9d876b1218efe90e14f8b912b0603/libpod/networking_linux.go#L396-L401 Tested on Fedora 34 Signed-off-by: Akihiro Suda <[email protected]>
Kernel 5.11 introduced support for rootless overlayfs, but incompatible with SELinux. On the other hand, fuse-overlayfs is compatible. Close issue 42333 Signed-off-by: Akihiro Suda <[email protected]>
b0c03f7 to
4300a52
Compare
thaJeztah
approved these changes
May 19, 2021
Member
thaJeztah
left a comment
There was a problem hiding this comment.
SGTM 😞
did we have this mentioned in the documentation already as a known limitation?
| if os.Getenv("_DOCKERD_ROOTLESS_SELINUX") == "1" { | ||
| // Kernel 5.11 introduced support for rootless overlayfs, but incompatible with SELinux, | ||
| // so fallback to fuse-overlayfs. | ||
| // https://github.com/moby/moby/issues/42333 |
Member
There was a problem hiding this comment.
There's no known fix yet? Is this a kernel bug?
Member
Author
There was a problem hiding this comment.
I’m not sure, I guess we can revisit this after the release of Fedora 35
Member
|
Wondering if this should actually "close" #42333, or if we need to keep that one open for tracking? wdyt? |
Member
Author
I think we can close it, and reopen when there is any action we can actually work on. |
Member
Author
|
Can we get this and #42199 in v20.10.7? 🙏 |
Member
|
@AkihiroSuda sorry, my email backlog has been growing :( |
Member
Author
|
Cherry-pick to 20.10: #42462 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contains #42199 (
dockerd-rootless.sh: avoid /run/xtables.lock EACCES on SELinux hosts)- What I did
Close #42333 (
rootless+overlay2 (kernel 5.11)+SELinux: mkdir /home/<USER>/.local/share/docker/overlay2/<CID>-init/merged/dev: permission denied.)- How I did it
Disable overlay2 when
$_DOCKERD_ROOTLESS_SELINUXis set.We can't rely on
go-selinux.GetEnabled()because RootlessKit doesn't mount /sys/fs/selinux in the child: rootless-containers/rootlesskit#94- How to verify it
docker infoshowsfuse-overlayfsas the default storage driver on rootless, while retainingoverlay2on rootfuldocker run hello-worldworks on rootless- Description for the changelog
rootless: disable overlay2 if running with SELinux
- A picture of a cute animal (not mandatory but encouraged)
🐧