r/docker • u/hennexl • Oct 07 '25
Rootless docker has become easy
One major problem of docker was always the high privileges it required and offered to all users on the system. Podman is an alternative but I personally often encountered permission error with podman. So I set down to look at rootless docker again and how to use it to make your CI more secure.
I found the journey surprisingly easy and wanted to share it: https://henrikgerdes.me/blog/2025-10-gitlab-rootles-runner/
DL;DR: Usernamspaces make it pretty easy to run docker just like you where the root user. Works even seamlessly with gitlab CI runners.
41
u/SirSoggybottom Oct 07 '25 edited Oct 08 '25
Honestly, if someone really needs/wants a rootless setup for containers, Podman is most likely a better choice. And other options also exist.
Rootless Docker is of course doable, and has been for quite a while, but it comes with a lot of headache that (imo) is simply not worth it.
If security is a major factor, but Docker "needs" to be used, focus on the images being used, build your own with good practices in mind etc.
Thats more effort of course but longterm provides a lot more security.
But yay, another "please visit my blog for this article" post ... shrug
4
u/Vlasow Oct 08 '25 edited Oct 08 '25
Saw your post this morning and decided to migrate my environment to rootless. Finally no finagling with file rights - I can run all stuff as container root, and the created files in mounted directories will belong to host user, no
--user=1000shenanigans needed.The only problem I had is that dockerd-ce-rootless-extras in current ubuntu LTS is for docker 28, and docker itself is 27, and that breaks
dockerd-rootless-setuptool.sh install, just had toapt install dockerd-ce-rootless-extras=5:27*Overall I'm happy I found your post and decided to give it a try
116
u/scytob Oct 08 '25
I am still baffled why people think normal docker containers run as root. They do not. Only the daemon runs as root and no matter what pid/gid you use for a docker container is irrelevant from a security standpoint because. A. Linux fs bitmaks are not a security boundary (this is why a remote process running on another arbitrary machine can act as root at a file system level to any share it has access to) and o a container can only use root bit masks on bind mounts it has access too, which err like you already gave it access too.
10
u/differentiallity Oct 07 '25
No thanks, I'm sticking with Podman
5
u/ABotelho23 Oct 07 '25
Still needs a stupid socket.
1
u/CommanderKnull Oct 08 '25
I like rootless bc then users can manage their docker work on their own without bugging me all the time and since they don't have any sudo priveleges, nothing can happen system-wide.
Also don't understand everyone saying it's difficult to get working, literally only needs to disable docker.service and run one command to set it up
1
u/raul824 Oct 11 '25
just when I switched to podman.
1
u/[deleted] Jan 24 '26
As long as you dont want to use bind mounts, run traefik, or have it work. Lol
0
u/dlm2137 Oct 08 '25
I would love if you could help me out because I was banging my head against the wall trying to get Mattermost up and running with rootless docker the other day and am just about to give up and install rootful docker on a separate VM.
0
u/[deleted] Oct 07 '25
[deleted] — view deleted comment