This document outlines the key differences between the Alpine and Debian variants of the kooldev/php Docker images.
| Feature | Alpine | Debian |
|---|---|---|
| Base Image | php:8.x-fpm-alpine |
php:8.x-fpm-bookworm (Debian 12 stable) |
| Image Size | Smaller (~150MB) | Larger (~400MB) |
| Package Manager | apk |
apt-get |
| Shell | sh (BusyBox) |
bash |
| Privilege Drop | su-exec |
gosu |
| Supervisord | Python supervisor (Alpine package) | Python supervisor (Debian package) |
| Architecture | amd64 + arm64 | amd64 + arm64 |
| glibc | musl libc | glibc |
Choose the Debian variant when:
- Compatibility issues with Alpine - Some PHP extensions or native libraries may have issues with musl libc
- Debugging needs - Debian includes more debugging tools out of the box
- Familiarity - Teams more familiar with Debian/Ubuntu environments
- Native library compatibility - Some C libraries behave differently with glibc vs musl
Choose the Alpine variant when:
- Minimal image size is critical - Alpine images are significantly smaller
- Security through minimalism - Smaller attack surface with fewer packages
- musl libc is acceptable - Your application has no compatibility issues with musl
Note: Both Alpine and Debian variants now support multi-arch (amd64 + arm64).
Both Alpine and Debian now use the official Python-based supervisord package (installed via apk add supervisor and apt-get install supervisor respectively). The configuration format is identical:
# supervisor.conf (both Alpine and Debian)
[supervisord]
logfile=/dev/stdout
logfile_maxbytes=0
pidfile=/run/supervisord.pid
nodaemon=true
[program:php-fpm]
command = php-fpm
priority = 10
autorestart = true
stopasgroup = true
killasgroup = true
stderr_logfile = /dev/stderr
stdout_logfile = /dev/stdout
stderr_logfile_maxbytes = 0
stdout_logfile_maxbytes = 0
[program:nginx]
command = nginx -g "daemon off;"
priority = 20
autorestart = true
stopasgroup = true
killasgroup = true
stderr_logfile = /dev/stderr
stdout_logfile = /dev/stdout
stderr_logfile_maxbytes = 0
stdout_logfile_maxbytes = 0Key configuration points:
prioritycontrols startup order (lower number starts first)nodaemon=truekeeps supervisord in foregroundstdout_logfile_maxbytes=0disables log rotation for stdout/stderr
Alpine uses sh shell with su-exec:
#!/bin/sh
# ...
exec su-exec kool "$@"Debian uses bash with gosu:
#!/bin/bash
# ...
exec gosu kool "$@"Alpine:
RUN apk add --no-cache nginx \
&& apk add --no-cache --virtual .build-deps ... \
&& apk del .build-depsDebian:
RUN apt-get update \
&& apt-get install -y --no-install-recommends nginx \
&& rm -rf /var/lib/apt/lists/*Alpine:
chmod 770 /var/lib/nginx/tmpDebian:
chmod 770 /var/lib/nginxTo migrate from Alpine to Debian:
-
Update your image tag:
# docker-compose.yml # From: image: kooldev/php:8.4-nginx # To: image: kooldev/php:8.4-debian-nginx
-
Shell scripts: Update any scripts that use:
su-exec→gosu- BusyBox-specific commands → standard GNU coreutils
shshebang →bashshebang (if using bash features)
-
Test thoroughly: The glibc vs musl difference can cause subtle behavior changes in some applications
Note: Supervisor configuration format is now identical between Alpine and Debian, so no changes needed for custom supervisor configs.
kooldev/php:8.4-debian- Base FPM imagekooldev/php:8.4-debian-prod- Production FPM image (no dev tools)kooldev/php:8.4-debian-nginx- FPM + Nginx with supervisordkooldev/php:8.4-debian-nginx-prod- Production FPM + Nginx