Guide: Running Linuxserver containers with rootless podman in their own user namespace #78
Unanswered
RiverNewbury
asked this question in
Other
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Note: This is not an official guide - it has been tested with the jellyfin container as that was the only one I need to run but I have strong reasons to believe this will work with any containers.
Assumptions
Motivations
Steps
On my homeserver I run all my containers all run with
--userns autowhich automatically deals with the namespaces however as the linuxserver containers which to another user on start-up none of the permissions on volumes etc work. So I came up with the following:/etc/subuidand/etc/subgidi.e.user:100000:65536(for this I assume that this is the only mapping I have)podman volume create jellyfin-config --uid 2000 --gid 2000these values for uid and gid are explained laterpodman run --rm -v jellyfin-config:/config:Z -e PUID=1000 -e PGID=1000 --uidmap 0:1000:1024 docker.io/linuxserver/jellyfin:10.11.5IMPORTANT: If you normally run with
--userns=autothen you will likely have theUflag by default on all volume mounts - we do not want that as it will cause the volume to be chowned by the root user in the container every time we start it.Explanation
The way that this works is that as we are using rootless podman it will automatically covert any UID we give it into the absolute system UID rather than the one in the user namespace with 0 -> (userID); 1 -> (first value in first entry of /etc/subuid for user); ... we gave the values to the container for what namespace to run in the intermediate form and so it will actually run with root user absolute UID 101000 and it has access all the way up to UID 102024.
We told the linuxserver container to run as user 1000 inside the container - which is intermediate UID 2000 in our user namespace or absolute UID 102000. We mounted the volume as intermediate UID 2000 so it lines up with the with user inside the linuxserver container.
Now this is all fixed it will work just like any other rootless podman container - which is to say not officially supported by linuxserver but pretty reliably.
I hope this helps and if you think I could improve this or make it clearer feel free to comment.
Beta Was this translation helpful? Give feedback.
All reactions