Skip to main content

PHP Docker Images ByJG

Sponsor Opensource ByJG Install MCP Server GitHub source Build Status

Overview​

A complete, lightweight, and versatile PHP Docker image collection based on Alpine Linux. These images are designed to be small, efficient, and ready to use in various environments.

Key Features​

  • Lightweight: Based on Alpine Linux, with optimized image sizes (~135-154MB)
  • Multi-architecture support: Runs on amd64 (x86_64) and arm64 (Raspberry PI, Graviton)
  • Multiple PHP versions: From PHP 5.6 to the latest PHP 8.6
  • Variety of configurations: Base, CLI, FPM, FPM-Nginx, and FPM-Apache variants
  • Pre-installed extensions: 45+ PHP extensions included in all images
  • Development tools: Composer, PHPUnit, PHP Code Sniffer, and more in CLI images
  • Production-ready: Optimized for both development and production environments
  • Security-hardened: Runs as non-root user (app), includes SBOM & build provenance

Documentation Index​

See full documentation at: https://opensource.byjg.com/docs/devops/docker-php

Quick Start​

# Pull an image
docker pull byjg/php:8.3-cli

# Run PHP
docker run -it --rm byjg/php:8.3-cli php --version

# Use with your project
docker run -v $PWD:/workdir -w /workdir byjg/php:8.3-cli php script.php

Image Variants​

Five different images for each PHP Version:

Image TypeDescription
baseMinimal image with 45+ PHP extensions and Composer
cliDevelopment tools (PHPUnit, PHP_CodeSniffer, PHPMD)
fpmPHP-FPM for custom web server configurations
fpm-nginxComplete LEMP stack (Nginx + PHP-FPM)
fpm-apacheComplete LAMP stack (Apache + PHP-FPM)

Supported PHP Versions​

VersionLatest VersionMonthly BuildsAlpine Version
8.68.6.0yesedge/testing
8.58.5.13yesedge
8.48.4.28yesedge
8.38.3.37yesedge
8.28.2.31-3.22
8.18.1.31-3.19
8.08.0.30-3.16
7.47.4.33-3.15
7.37.3.33-3.12
7.27.2.33-3.9
7.17.1.33-3.7
7.07.0.33-3.5
5.65.6.40-3.8

PHP 8.6 packages come from Alpine edge/testing, the only Alpine repository that carries them so far. To add a package such as imagick, see Imagick on PHP 8.6.

Unmaintained images

Only the versions with monthly builds receive updates. The images for the other versions (8.2 and older, including all 7.4-* tags) are unmaintained: they are not rebuilt and get no PHP, nginx or Alpine security fixes. They are exposed to every vulnerability fixed after their last build, including the critical PHP and nginx issues fixed in November 2026. Move to a version with monthly builds.

Security update 2026.11

The 2026.11 images ship PHP 8.3.37, 8.4.28 and 8.5.13 and nginx 1.30.7, which fix critical PHP and nginx (HTTP/2) vulnerabilities. Images tagged 2026.10 or older are affected: pull the 2026.11 tag. See Security Notices.

warning

Why Alpine edge? PHP 8.2-8.6 use Alpine edge to avoid critical unpatched vulnerabilities in Alpine 3.22, including CVE-2023-27482 (supervisor) and other security issues. Monthly tagged releases (YYYY.MM) provide stability checkpoints. See Security Features for details.

tip

For Production: Pin to specific monthly tags for guaranteed reproducibility:

docker pull byjg/php:8.4-base-2025.11

Use Cases​

These images are ready to use in:

  • Development Environment - Fast setup with all tools included
  • Production Environment - Optimized, lightweight containers
  • CI/CD Pipelines - Travis-CI, Circle-CI, Jenkins, Bitbucket Pipelines, GitHub Actions
  • IDE Integration - Full PHP support without local installation (see IDE Integration)

Image Sizes​

Uncompressed sizes for reference:

Build TypeUncompressed Size
base~135MB
cli~154MB
fpm~139MB
fpm-nginx~154MB
fpm-apache~154MB

Open source ByJG