u/bluesphemy

▲ 5 r/podman

userns=auto container inside VM with VirtioFS datasets

I'm trying to get my head around the best approach to have my rootful containers setup with userns=auto inside a VM with the necessary ZFS datasets that live on the Proxmox host passed into the VM via VirtioFS.

Let's say I have two datasets on the proxmox host: media (0:2200) and svc (0:2100). Both passed into the VM via VirtioFS and mounted at /srv/media and /srv/svc.
And let's take Jellyfin as an example for a container where the two volumes are mapped /srv/media:/media:ro and /srv/svc/jellyfin:config
With userns=auto set what are my best options? From some research I'm seeing two options but maybe someone with more indepth knowledge could weigh in.

Option 1:
userns=auto:gidmapping=0:2100:1,gidmapping=2200:2200:1
or make it a bit easier and give let's say user 2000 on the proxmox host ownership of both datasets so it would look something like this:
userns=auto:uidmapping=0:2000:1,gidmapping=0:2000:1

Option 2:
first add to /etc/subgid
containers:2147483647:2147483648
containers:2100:1
containers:2200:1

then in the quadlet add:
[Container]
UserNS=auto
PodmanArgs=--gidmap=+g2100:@2100 --gidmap=+g2200:@2200
GroupAdd=2100
GroupAdd=2200

is one of those approaches sound or am I missing something? Or do the pros here have a better way to do what I want?

reddit.com
u/bluesphemy — 13 days ago