provides an optimized Docker image for PHP-FPM, based on Alpine Linux. It is designed to offer a lightweight and flexible solution for developers and system administrators deploying PHP applications in containers.
- Prerequisites
- Overview
- Quick Start
- Usage with Docker Compose
- License
The required tools depend on your use case:
-
To build and run Docker images:
- Docker: Required for building and running containers.
-
To use multi-container setups:
- Docker Compose: Required for managing multiple containers via
compose.yaml
.
- Docker Compose: Required for managing multiple containers via
- Alpine-based image (Dockerfile) with PHP 8.4 FPM and essentials.
- FPM socket at
/var/run/php/www.sock
, suitable for sharing with a reverse proxy. - Simple entrypoint and default command: php-fpm -F.
- Healthcheck using cgi-fcgi that hits /ping and expects "pong".
- Clone and (optionally) prepare a local override
git clone https://github.com/mztrix/docker-php-fpm
cd docker-php-fpm
cp compose.override.yaml.dist compose.override.yaml # recommended for local use
- Start PHP-FPM
docker compose up -d --wait
This builds the local image (target: base) and starts the php service.
- Check status
docker compose ps
docker compose logs -f php
- compose.yaml defines the minimal php service.
- compose.override.yaml(.dist) shows useful local mounts:
.docker/php.ini
->/etc/php84/php.ini
.docker/php-fpm.d/www.conf
->/etc/php84/php-fpm.d/www.conf
- fpm-sock volume ->
/var/run/php
Environment/build variable:
- IMAGES_PREFIX (optional): image name prefix used by compose (defaults to mztrix/php-fpm).
MIT — see LICENSE.