Security

Hardening

What the images do by default to reduce attack surface, and what you can add at runtime.

Built in

MeasureDetail
Non-root executionUID 1000 by default across every image. See Users and permissions.
No setuid or setgid binariesbusybox-suid is not installed; setuid bits from shadow are stripped.
Root-owned configurationEverything under /etc stays root-owned; runtime config is rendered into /run.
Read-only rootfs supportWorks with --read-only plus tmpfs mounts, so tampering does not survive a restart.
No phpinfo() default pageA static placeholder is served when no application is mounted, so environment variables cannot leak.
expose_php offNo X-Powered-By header. server_tokens off hides the Nginx version too.
Hidden files denied/.env, /.git and any dot-prefixed path return 403. /.well-known/ is allowed.
Safe PHP dispatchcgi.fix_pathinfo=0 and security.limit_extensions=.php.
Security headersX-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy on every response.
TLSTLS 1.2 and 1.3 only, Mozilla intermediate ciphers, session tickets off, HSTS on.
Fixed redirect targetThe HTTPS redirect uses the configured server name, not the request Host.
Secure cookiesHttpOnly, SameSite=Lax, and Secure whenever HTTPS is on; use_strict_mode on.
allow_url_include offRemote file inclusion disabled.
Digest-pinned basealpine:3.24@sha256:..., plus apk upgrade at build time.
HTTPS package sourcesAlpine repositories are fetched over HTTPS.
Pinned PHPExact release per minor, asserted after installation.
Scanned before publishTrivy gates every tag. See Scanning and attestations.

These are not defaults because they depend on your application, but they are cheap wins.

--read-only --tmpfs /run:uid=1000,gid=1000 --tmpfs /var/log:uid=1000,gid=1000 \
--tmpfs /var/lib/nginx:uid=1000,gid=1000 --tmpfs /tmp
--cap-drop ALL --security-opt no-new-privileges
-e PHP_OPEN_BASEDIR=/var/www/html:/tmp
-e PHP_DISABLE_FUNCTIONS=exec,passthru,shell_exec,system,proc_open,popen
-e PHP_ALLOW_URL_FOPEN=Off
-e NGINX_SERVER_NAME=app.example.com

Mount your application read-only (:ro) and give PHP a separate writable volume for uploads and cache.

Reporting a vulnerability

Open an issue at github.com/AdamRollinson/docker/issues. For anything sensitive, use GitHub's private vulnerability reporting on the repository.