I just found that rootless docker is unable to work on ZFS devices which are VFS idmap shifted.
The log says: [rootlesskit:parent] error: failed to start the child: fork/exec /proc/self/exe: permission denied
The command it tries to run is: rootlesskit --net=slirp4netns --mtu=65520 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --disable-host loopback --port-driver=builtin --copy-up=/etc --copy-up=/run --propagation=rslave /usr/bin/dockerd-rootless.sh
Any suggestions what may be a reason and is it possible to fix it?
I tried Ubuntu Jammy and Debian Bookworm as unprivileged containers with security nesting enabled. Host is Ubuntu with ubuntu kernel 6.6.0-14.
I made an experiment and replaced filesystem for docker rootless user with btrfs and there is no change in dockers behaviour, the same error.
Note that this is a weird change of behavior that’s only part of the Ubuntu kernel, other distributions do not do that, nor does running a non-Ubuntu kernel on Ubuntu.
The recommended solution for this is apparently to create an apparmor profile for the application (rootlesskit) which then allows userns_create. I’m not sure if this is something that can be used from within a container though.
Another option is to not use the Ubuntu kernel but use a clean upstream kernel instead.
I do make such kernel packages if you want to go this route. Given you’re using ZFS, you’d need both:
Thank you very much, Stephane, for detailed explanation. Reading the ticket on launchpad I am shocked how reckless is Mr Johansen in his experiments made without any plan and without caring about consequences.
I need to investigate which of paths you have suggested I will follow, I will share my experiences soon.
So my decision was to replace Ubuntu with Bookworm as for today it’s newer than Jammy and has similar perspectives of long term support plus replaced standard Debian kernel with Zabbly one.
After reading Ubuntu tickets I rejected going forward with Ubuntu kernel as it’s simply unpredictable and patching it with own apparmor rules may be time consuming and surprising.
Rootless docker works now, with ZFS VFS uid shifting as I planned.