WADDLE_UID and WADDLE_GID

What WADDLE_UID and WADDLE_GID are, why container processes need them, and when Waddle sets them locally and on remotes.

WADDLE_UID and WADDLE_GID are two environment variables holding your real host user’s numeric user ID and group ID. Waddle uses them to make container processes run as you instead of as root, so files those processes create end up owned by the right person on the host.

Why container processes need this

A container process, PHP-FPM writing a cache file, or an app handling an upload, is owned by whichever user the Docker daemon assigns it. Unless a container specifies otherwise, that means it runs as root inside the container. If the Docker daemon itself is running as root, anything that process writes into a bind-mounted host directory ends up owned by root on the host too, files you then can’t read, write, or delete without sudo.

Passing WADDLE_UID/WADDLE_GID into the container and pinning its process to that UID/GID sidesteps the problem: the process runs with your privileges from the start, so anything it creates is already owned by you.

Where the values come from

Locally, Waddle populates them from your actual account (id -u / id -g) if they aren’t already set in your shell. On a remote, Waddle reads the same values over SSH, from whichever account the remote is configured to connect as.

When Waddle sets them

Whether Waddle needs to pass these values in at all depends on whether the relevant Docker daemon, local or remote, is running rootless or as root:

  • Rootless Docker remaps container UID 0 to the daemon owner’s real UID automatically, via kernel user namespaces. No explicit WADDLE_UID/WADDLE_GID is needed, so Waddle omits them.
  • Root Docker has no such mapping, so Waddle writes WADDLE_UID/WADDLE_GID into the project’s .env file, at build time locally or deploy time remotely, and the relevant Compose file references them via a user: directive so docker compose picks them up automatically.

On a remote, exporting them this way is a deliberate fallback with a security trade-off of its own, see Run Docker Rootless on Remote Servers for why rootless is still the better default there.

Running docker compose manually

If you run docker compose yourself in a project Waddle hasn’t built yet, WADDLE_UID/ WADDLE_GID won’t be in the .env file. Either build the project through Waddle first, or export them yourself:

export WADDLE_UID=$(id -u)
export WADDLE_GID=$(id -g)