Guide · DevOps, developers
Docker and containers
1. Discovery#
Read-only: changes nothing
# Containers and images
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'
# PHP version inside every container that has php
for c in $(docker ps -q); do
v=$(docker exec "$c" sh -c 'command -v php >/dev/null && php -v | head -1' 2>/dev/null)
[ -n "$v" ] && echo "$(docker inspect -f '{{.Name}}' "$c"): $v"
done
# Kubernetes: images in use
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"\t"}{range .spec.containers[*]}{.image}{" "}{end}{"\n"}{end}' 2>/dev/null
The CLI inside a container is usually the same binary build as its FPM, but confirm this with php-fpm -v where available.
2. Which fixed version you need#
- Official
phpimage (Docker Hub) and images that build from source: upstream numbers, i.e. tags8.2.35,8.3.36,8.4.27,8.5.12or later. Floating tags (e.g.8.4-fpm) point to the new version once they are republished; confirm withphp -vafter pulling. - Images that install PHP from packages (Alpine
apk, Debian/Ubuntuapt): the distribution’s backports apply. - The PHP Foundation reports that Chainguard made fixed images available on 21 October.
- Third-party images (e.g. applications that bundle PHP): wait for, or request, an update from the publisher.
3. Rebuild and recreate#
Changes packages or configuration: back up and test first
# Prefer an explicit fixed version instead of "latest"
FROM php:8.4.27-fpm
# Docker Compose: pull new base images, rebuild, recreate
docker compose build --pull
docker compose up -d --force-recreate
Restart: possible brief service interruption
# Kubernetes: after updating the image in the manifest/Helm values
kubectl -n NAMESPACE rollout restart deployment/NAME
kubectl -n NAMESPACE rollout status deployment/NAME
If you use pinned digests (@sha256:…), update them; otherwise the rebuild will reuse the old image.
4. Verification#
Read-only: changes nothing
docker compose exec php php -v
docker image inspect --format '{{.Created}}' $(docker compose images -q php)
FrankenPHP#
The PHP project explicitly lists FrankenPHP among the affected environments. FrankenPHP embeds PHP in its own binary/image: you need a FrankenPHP release built with fixed PHP. In worker mode the application stays loaded in memory, so the process or container must be restarted.
Main source: PHP project · The PHP Foundation