Run Docker Rootless on Remote Servers

Why the Docker daemon on a remote server should run rootless, and the security gap a root daemon opens when containers run as your host user.

Waddle detects whether a remote’s Docker daemon is running rootless or as root, and supports either. When it’s running as root, Waddle deliberately exports the real host WADDLE_UID / WADDLE_GID into the container environment as a fallback, and that specific combination, root daemon plus exported UID/GID, opens a real security gap worth understanding, even if you never touch either setting directly yourself.

Why the fallback exists

Without WADDLE_UID/WADDLE_GID, a root Docker daemon runs container processes as UID 0, so anything they write into a bind-mounted host directory ends up owned by root. Exporting the real host values is what keeps that from happening, see WADDLE_UID and WADDLE_GID for the full picture of what they are and when Waddle sets them. Rootless Docker does not need the fallback in the first place, because its own user-namespace remapping keeps file ownership correct without any exported variables.

Why the combination is risky

With those variables exported, containers start running as an unprivileged host user from the moment they boot. That means daemons like PHP-FPM and Nginx never start with elevated privileges in the first place, so they have nothing to drop.

Normally, a daemon that starts privileged and then deliberately drops to an unprivileged user before handling any untrusted input is a defense-in-depth measure: even a full remote-code- execution exploit in the application only grants an attacker whatever the already-unprivileged daemon user can do. Skip that drop, and a PHP-level RCE is one step closer to doing real damage on the host, not just inside an already-contained, unprivileged process.

Why rootless Docker avoids it

Running the Docker daemon rootless sidesteps the problem. Rootless Docker maps container root to an unprivileged user on the host automatically. That means daemons inside the container can still start as root-in-container, bind privileged ports, and drop privileges as designed, all while the actual host-level user the daemon ends up running as stays unprivileged and correctly mapped to the right file owner.

In short

On a remote server, prefer a rootless Docker daemon. Running Docker as root on a remote is always a security risk you should avoid. Any exploit that manages to escape container confinement in that scenario would own your server.