Sub topic 14
What rootless mode does not support
This chapter assumes you have a working rootless daemon, as set up in the earlier chapters. You should also know how user namespaces map IDs and how the daemon talks to the client.
Rootless mode trades some features for safety. The daemon is an ordinary user process, so anything that needs real host privileges is unavailable or limited. Knowing these limits up front saves debugging time.
Where the limits come from
Most limits trace back to one of three causes. The kernel does not let an unprivileged user do the thing, the user namespace hides the real host, or the networking path runs in user space.
Features that are unavailable
| Feature | Behavior in rootless mode |
|---|---|
| AppArmor profiles | Not supported |
| Container checkpointing | Not supported |
| Overlay networks (Swarm) | Not supported |
| Publishing SCTP ports | Not supported |
| Ports below 1024 | Blocked until you lower `net.ipv4.ip_unprivileged_port_start` |
| `ping` in containers | Works only if `net.ipv4.ping_group_range` includes your group |
| CPU and memory limits | Work only with cgroup v2 and systemd delegation |
Features that behave differently
Host network mode and `--privileged`
--network host attaches the container to the network namespace of the rootless daemon, not to the real host network. The container does not see the host's interfaces.
--privileged grants all capabilities, but only inside the user namespace. It does not give the container host root. A container that needs raw access to host devices will usually fail.
Published ports and source IPs
Rootless networking passes traffic through RootlessKit, so published ports are slower than in rootful mode. With the default port driver, a container may see the connecting client's address replaced by an internal one. The slirp4netns port driver preserves the source IP at a performance cost. You select it with an environment variable for the daemon.
Storage
Only some storage drivers work. These are overlay2 (on a recent kernel, or on Ubuntu and Debian kernels that allow it), fuse-overlayfs, btrfs and vfs. The vfs driver is the slowest because it copies layers instead of sharing them. Check which driver you got with docker info.
File ownership on bind mounts
Container root is your host user. Container user 1000 maps to a subordinate ID that no real host account owns. A bind-mounted directory can therefore show unexpected owners, and a non-root process in the container may not be able to write to it.
Checking two common gaps
This checks for ping and for cgroup limit support.
# ping fails with "Operation not permitted" if your GID is outside the range
cat /proc/sys/net/ipv4/ping_group_range
# Allow all groups to use unprivileged ICMP sockets
echo 'net.ipv4.ping_group_range = 0 2147483647' | sudo tee /etc/sysctl.d/99-rootless-ping.conf
sudo sysctl --system
# A warning about missing cgroup support means limits are ignored
docker run --rm --memory 256m alpine trueChoosing between modes
Use rootless mode when the main concern is limiting damage from a daemon or container compromise. Stay with rootful Docker when you need AppArmor, Swarm overlay networks, full network performance, or access to host devices.
Exercise
A container in your rootless setup logs the connecting client's address as an internal one, and you need the real source IP. What is the trade-off of fixing this?
Show answer
Switch the RootlessKit port driver to slirp4netns, which preserves the source IP. The cost is lower network throughput for published ports.
Exercise
You run a container with --privileged in rootless mode, and it still cannot access a host block device. Why?
Show answer
The privileges apply only inside the user namespace, and your unprivileged host user cannot open the device. The container never gains host root.