The Docker daemon runs as root, and membership of the docker group is root by another name. Anyone who can run docker run can mount the host filesystem and read /etc/shadow. Rootless mode removes that grant: the daemon runs as an unprivileged user, so a container breakout lands on an ordinary account rather than the host itself.
This is the single most misunderstood point about Docker security. Running your container process as a non-root user inside the image is good hygiene, and I have written about doing exactly that. But it does nothing about the daemon. The daemon still runs as root on the host, and the socket that controls it is a root-equivalent capability handed out through a Unix group. Rootless mode is the part that actually moves the trust boundary. This is how you set it up on Ubuntu 24.04, and, just as importantly, where it is the wrong call.
What rootless mode actually changes
In rootless mode the entire daemon, the containers, and the CLI run inside a user namespace owned by your login account. The container’s root (UID 0) is mapped to your unprivileged UID on the host, and the rest of the container’s user IDs are mapped to a block of subordinate UIDs allocated to you. If a process escapes the container, the kernel still sees it as your user with no host privileges — not as UID 0 on the host.
Free · 4 minutes
Would you survive contact with a determined attacker — or an auditor?
Fourteen questions on access, patching, detection, and recovery — the basics that prevent most real incidents, and the ones most often assumed rather than verified. Banded finding on screen, full sheet by email.
You pay for this. Rootless mode cannot bind ports below 1024 without extra configuration, its default networking goes through a userspace stack (slirp4netns or pasta) that is slower than the kernel bridge, some storage drivers and cgroup features are constrained, and a handful of options such as host networking behave differently or not at all. For most application workloads none of that matters. For a high-throughput network appliance it might. Decide before you install, not after.
Prerequisites and the subuid ranges
Rootless mode needs the newuidmap and newgidmap helpers (the uidmap package) and a running user D-Bus session (dbus-user-session). It also needs at least 65,536 subordinate UIDs and GIDs allocated to your account in /etc/subuid and /etc/subgid. On a normal desktop or server install the account created at setup usually has these already; a service account you added by hand may not.
# Prerequisites (run as an admin, once)
sudo apt-get update
sudo apt-get install -y uidmap dbus-user-session docker-ce-rootless-extras
# Confirm you have subordinate ID ranges. Each line should show
# a start plus a count of at least 65536, e.g. deploy:100000:65536
grep "^$(whoami):" /etc/subuid /etc/subgid
# If nothing comes back, allocate a range for the account:
sudo usermod --add-subuids 100000-165535 \
--add-subgids 100000-165535 "$(whoami)"
One Ubuntu 24.04 specific trap: the kernel now restricts unprivileged user namespaces through AppArmor by default (kernel.apparmor_restrict_unprivileged_userns=1). If you install rootless Docker from the official .deb packages, the docker-ce-rootless-extras package ships the AppArmor profile that allows it, and it just works. If you install through the convenience script (curl -fsSL https://get.docker.com/rootless | sh), you must create the profile yourself for ~/bin/rootlesskit, or user-namespace creation is blocked outright. Prefer the packaged install on Ubuntu for precisely this reason.
Installing as the unprivileged user
Everything from here runs as the target user, not with sudo. If the system-wide Docker daemon is installed and running, disable it first so the two do not fight over sockets — sudo systemctl disable --now docker.service docker.socket. Then, logged in as the account that will own the containers:
# As the unprivileged user (no sudo)
dockerd-rootless-setuptool.sh install
# The tool writes a systemd *user* unit to
# ~/.config/systemd/user/docker.service
# and installs client binaries under ~/bin. Start it and
# have it come up on boot for this user:
systemctl --user enable --now docker.service
# Point the CLI at the rootless daemon. id -u resolves your UID
# so the path is correct on any account.
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc
echo "export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock" >> ~/.bashrc
source ~/.bashrc
A user service only runs while that user has an active login session. The moment they log out, systemd tears down their services and your containers stop. That is fine for interactive work and wrong for anything you expect to survive a reboot. The fix is lingering, which tells systemd to start the user’s manager at boot regardless of login. If you have set up a baseline systemd service before, this is the user-scope equivalent of enabling a system unit.
# Run once, needs admin. Makes the user's services start at boot
# and stay up across logout.
sudo loginctl enable-linger "$(whoami)"
# Confirm it took: Linger=yes
loginctl show-user "$(whoami)" --property=Linger
Verifying the daemon is genuinely unprivileged
Do not take the installer’s word for it. Two checks settle the matter. First, docker info reports rootless mode explicitly. Second, look at the process table: the daemon must be owned by your user, not root.
# Security options should list 'rootless'; Cgroup Version 2
docker info --format '{{.SecurityOptions}}'
# -> [name=seccomp,profile=builtin name=rootless name=cgroupns]
# The daemon must NOT be owned by root. Expect your username here.
ps -o user= -C dockerd
# Sanity run: inside the container root is UID 0, but on the host
# that process shows up as your unprivileged user, not root.
docker run --rm alpine id
ps -o user=,cmd= -C sleep & docker run --rm alpine sleep 5
If ps -o user= -C dockerd prints root, you are still talking to the system daemon — check DOCKER_HOST and that you disabled the system service.
The port-binding limitation, handled honestly
An unprivileged process cannot bind ports below 1024, so -p 80:80 fails out of the box. There are two ways round it and I would reach for the first only when you must. You can grant the capability to the RootlessKit binary that owns the daemon’s network namespace:
# Option A: let rootlesskit bind low ports (needs admin, once)
sudo setcap cap_net_bind_service=ep "$HOME/bin/rootlesskit"
systemctl --user restart docker.service
# Option B (host-wide): lower the unprivileged port floor.
# Affects every process on the host, so weigh it.
sudo tee /etc/sysctl.d/99-rootless.conf <<'EOF'
net.ipv4.ip_unprivileged_port_start=80
EOF
sudo sysctl --system
The cleaner answer in almost every real deployment is neither. Bind the container to a high port and put the privileged listener where it belongs — a reverse proxy or the host’s own load balancer, terminating on 443 and forwarding to the rootless daemon on something like 8080. That keeps the one process that genuinely needs a low port outside the container runtime entirely, which is the whole point of the exercise.
Where rootless is the right call, and where it is not
Rootless is the right default for build agents, CI runners, developer workstations, and multi-tenant hosts where several teams share a box and you do not want any of them holding root-equivalent access through the docker group. It is a straightforward win anywhere the workload is ordinary application traffic and the threat you care about is a compromised container reaching the host.
It is the wrong call where the workload needs the kernel bridge for throughput, needs privileged host access by design (storage plugins, low-level networking, certain observability agents), or where an orchestrator already owns the isolation model — a managed Kubernetes node is not the place to be hand-rolling rootless daemons. And it is not a substitute for the other controls: you still run the process inside the container as non-root, you still drop capabilities, and you still keep the daemon and its user service managed like any other unit, the same discipline you would apply when moving scheduled work onto systemd.
Rootless mode does not make Docker safe. It removes one specific, large, and routinely overlooked privilege: the assumption that access to the container runtime means access to the host. On a regulated estate, that is the assumption an auditor will eventually test — better to have already closed it than to explain why the docker group has fifteen members with root.
Free interactive tool
Website compliance checklist
What your site has to do, based on what it actually does
Answer as much or as little as you like — the list builds as you go. Nothing is stored against your name and no email is required.
Everything that applies
Ordered by what to do first: legal requirements you can close quickly, then larger pieces of work, then what is expected rather than required. Not exhaustive, and not a legal audit.
Dated PDF, yours to keep or circulate.
Most technology problems are not technology problems. They are control problems.
The systems exist. The investment has been made. The question is whether leadership can understand, direct, evidence, and sustain what those systems produce. Find out where control exists — and where it only appears to.