-
Notifications
You must be signed in to change notification settings - Fork 12
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
gVisor inside Docker #2
Comments
Hm, from my testing this was only necessary when enforcing RAM limits (which uses the cgroup controller to create a memory-constrained cgroup), and there is code to check that Does this error occur even when you have RAM limiting disabled (as is the default setting)?
It's not necessary to add |
I have added setup instructions for Docker. See if they can work around this problem without requiring |
Can you check if adding |
Thanks for the update. I checked out the setup instructions but wasn't able to get it to work without privileged. Here's a list of the things I've tried to no avail:
Here's the output of the self test:
Also, setting |
Thanks for testing this out. After some research, my current understanding of the cgroupfs issue is that there are two distinct things standing in the way of creating child cgroups:
$ docker run --rm busybox grep cgroup /proc/mounts
cgroup /sys/fs/cgroup cgroup2 ro,nosuid,nodev,noexec,relatime 0 0
$ docker run --rm --mount=type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup,readonly=false busybox grep cgroup /proc/mounts
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime 0 0
$ docker run --rm --privileged=true busybox grep cgroup /proc/mounts
cgroup /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime 0 0
$ docker run --rm busybox sh -c 'readlink /proc/self/ns/cgroup; cat /proc/self/cgroup'
/cgroup:[4026534726]
0::/
$ docker run --rm --cgroupns=host busybox sh -c 'readlink /proc/self/ns/cgroup; cat /proc/self/cgroup'
cgroup:[4026531835]
0::/system.slice/docker-da3f71d8360c44e0b1dc8629707bbac35cdbadc8f7d4f825cd781b099b746d55.scope ... So if my understanding is correct, things should work if you add both In the meantime, I have updated the container runtime setup doc to reflect the need for the above. |
Thanks for the detailed explanation. Unfortunately, the combination didn't work, and the error was the same. It seems to be the same error as this. |
@shg8 If you get the Thanks for pointing out the similarity with the Dangerzone issue you linked to as well. I wasn't suspecting it because you're running with regular Docker (which as far as I know mounts |
Oh I'm afraid this comes before the cgroup issue. The cgroup |
I tried your solution in the Dangerzone comment of setting a different tmpdir, but it didn't seem to make a difference. |
Hello again, I uploaded a new version of the code runner tool and function that includes a lot more debug logging, and should remove the need to do the whole cgroup dance because it will do that automatically. It also has more a elaborate self-test mode. The tool is available here and the function is available here. In order to debug your issue, I'd recommend creating a new container identical to the OpenWebUI one (without
If it fails, also add |
Thanks for the follow-up. Please see the output in the attached file. The same problem seems to persist. The container was started with the following.
|
Thank you for the debug log. The good news is that I've been able to reproduce this. The bad news is I still don't know why this is happening. It might be AppArmor (added a bullet point about it in the docs) but I don't think that's the last hurdle. Still looking. |
This fixes self-re-execution thanks to Open WebUI having merged open-webui/open-webui#5511. It also works around more permission issues due to procfs mounts. Docs updated. Fixes #11 Fixes #12 Updates #2 Updates #3
I think I figured it out. Please try 0.6.0 after doing the new instructions on the setup docs. Specifically, this means adding |
I believe this is fixed. Please reopen if you still experience this issue after updating to v0.6.0 and following the setup docs. There is also a separate issue when running in Docker with systems using old cgroups v1, but this is tracked in issue #14. |
Yup, everything works as expected now. Thanks a lot for debugging this issue. One question out of curiosity - does this approach provide more security over |
Thanks for the great project! Running gVisor inside a Docker container seems to require a privileged container. Additionally, I had to use this script to enable nested cgroup. Otherwise, I would get the following error:
Sandbox runtime failed: Sandbox failed to start: Command '['/tmp/gvisor/runsc', '--rootless=true', '--directfs=false', '--network=host', '--ignore-cgroups=false', '--root=/tmp/sandbox_cjm736ki/runtime', '--debug=false', '--debug-log=/tmp/sandbox_cjm736ki/logs/', 'run', '--bundle=/tmp/sandbox_cjm736ki/bundle', 'sandbox']' returned non-zero exit status 128.; stderr: running container: creating container: cannot set up cgroup for root: configuring cgroup: write /sys/fs/cgroup/cgroup.subtree_control: device or resource busy; logs: defaultdict(<class 'list'>, {'runsc.log.20240903-224047.843558.run.txt': ['W0903 22:40:47.845254 120 util.go:64] FATAL ERROR: running container: creating container: cannot set up cgroup for root: configuring cgroup: write /sys/fs/cgroup/cgroup.subtree_control: device or resource busy', 'W0903 22:40:47.845367 120 main.go:231] Failure to execute command, err: 1']})
The text was updated successfully, but these errors were encountered: