phppdf Docs

A Docker image for running PHP CLI tooling against a project

Source ↗

Docs

Running as your user

The image runs as a non-root user, app (UID/GID 1000), by default, so files created inside the container — vendor/, coverage reports, generated PDFs, etc. — are owned by UID 1000 on the host rather than root.

On most single-user Linux installations, the first regular user has UID/GID 1000, so no further configuration is needed.

Matching a different host user

If your user’s UID or GID is not 1000, pass --user to match it:

docker run --rm -v ./:/app -u "$(id -u):$(id -g)" ghcr.io/phppdf/docker-image-php-cli:dev composer install

With Compose:

docker compose run --rm --user "$(id -u):$(id -g)" cli composer install

In this case the container runs as a UID with no matching entry in /etc/passwd (so whoami won’t resolve), but Composer and other tools still work correctly.

Why root isn’t used

The image sets HOME=/tmp and COMPOSER_HOME=/tmp/composer, both of which are writable by any UID, so Composer and other tools work correctly regardless of which user (or --user override) runs the container — without needing a writable home directory for that UID.