By default the Docker daemon runs as root, which means a container escape can hand an attacker full host privileges. Docker rootless mode removes that risk by running the daemon and containers as an ordinary, unprivileged user, using user namespaces to map container root to a harmless host UID. The trade-off is a few networking and storage limitations, but for development machines, CI runners, and single-tenant servers it is a meaningful security win.
This guide installs Docker rootless mode on Ubuntu 24.04, wires it into systemd so it starts at login, exposes the usual Docker socket path, and fixes the common networking pitfalls.

How Docker Rootless Mode Works
Rootless Docker relies on Linux user namespaces. Inside the namespace, the container’s UID 0 maps to your unprivileged host UID, so processes inside the container believe they are root while the host kernel treats them as your user. That single mapping is what stops a breakout from becoming a host compromise: even if an attacker escapes the container, they only gain your user’s privileges, not root.
The daemon itself runs as a systemd user service (systemd --user), and the Docker socket lives under your runtime directory instead of /var/run/docker.sock. Tools that expect the default socket need a small environment adjustment, covered below.
Prerequisites
- Ubuntu 24.04 with a non-root user that has sudo access for the initial setup.
- At least 4 GB of RAM and a few GB of free disk for images.
- Any existing rootful Docker installation should be stopped first to avoid port and network conflicts, or kept only if you understand both daemons will be separate.
Step 1: Enable User Namespaces and Subordinate IDs
Ubuntu 24.04 ships with unprivileged user namespaces enabled, but rootless Docker also needs subordinate UID and GID ranges. Check that your user already has them:
grep "^$USER:" /etc/subuid /etc/subgid
You should see a line such as deploy:100000:65536. If the files are empty for your user, add ranges with:
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 "$USER"
Also enable lingering so your user services keep running after you log out, which matters for servers:
sudo loginctl enable-linger "$USER"
Step 2: Install Docker in Rootless Mode
Install the prerequisites and the rootless setup tool. If you already installed Docker packages from the official repository, the rootless helper ships with them:
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io uidmap dbus-user-session
Then run the installer as your normal user, never with sudo:
dockerd-rootless-setuptool.sh install
The script checks your kernel and subuid configuration, installs the systemd user unit, and starts the daemon. Verify it with:
systemctl --user status docker
docker info | grep -i rootless
You should see the daemon running and a context confirming rootless operation.
Step 3: Point Your Shell at the Rootless Socket
The rootless socket lives at $XDG_RUNTIME_DIR/docker.sock. Export it in your shell profile so docker and docker compose find it without flags:
echo 'export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock' >> ~/.bashrc
source ~/.bashrc
docker run --rm hello-world
If you run scripts as another user or through cron, remember that XDG_RUNTIME_DIR only exists for logged-in sessions with lingering enabled, which is why Step 1 enabled linger.
Step 4: Understand the Networking Limitations
Rootless Docker cannot create privileged network interfaces, so it uses a user-mode network stack (slirp4netns) by default. Practical consequences:
- Published ports below 1024 need extra configuration. Use high ports such as 8080 and front them with a reverse proxy, or enable
net.ipv4.ip_unprivileged_port_start=0via sysctl. - Throughput through slirp4netns is lower than the rootful bridge. For most web workloads it is fine; for high-throughput proxies, consider RootlessKit’s port driver or a rootful daemon instead.
- Host networking (
--network host) behaves differently and does not give the container the host’s network namespace in the usual sense.
For a typical application stack, publish ports above 1024 and put Nginx or Caddy in front, which is good practice regardless of mode.
Step 5: Manage Storage and Everyday Use
Images, volumes, and build cache live under ~/.local/share/docker. Because the daemon runs as your user, file ownership inside bind mounts is straightforward: files created by containers belong to you, not to root. That alone removes a whole class of permission headaches on development machines.
Useful day-to-day commands remain identical:
docker ps
docker volume ls
docker system prune -a --volumes
Be careful with that last command: it deletes all unused images and volumes for your user daemon, which is separate from anything the rootful daemon stored.
Troubleshooting Docker Rootless Problems
Daemon fails to start: “failed to load listeners”
Another daemon is already holding a socket, or DOCKER_HOST points at the rootful socket. Stop the rootful service with sudo systemctl stop docker if you are migrating, then restart the user service.
“newuidmap: write to proc failed” errors
Your subuid range is missing or too small. Re-check /etc/subuid and re-login after changing it, since group and namespace settings are read at session start.
Containers cannot reach the internet
Check that slirp4netns is installed (apt install slirp4netns) and that your firewall allows the user’s traffic. Also confirm DNS: rootless containers inherit the host resolver, and a restrictive /etc/resolv.conf can break name resolution inside containers.
Conclusion
Docker rootless mode trades a small amount of networking convenience for a large reduction in blast radius: a container escape no longer means host root. Install it as your own user, enable lingering, export the socket path, and keep privileged ports behind a reverse proxy. Pair it with image scanning, covered in our guide to scanning Docker images with Trivy, and with the storage choices in Docker volumes versus bind mounts. The official Docker rootless documentation covers advanced options such as systemd socket activation and the RootlessKit port driver.