Docker php:8.2-apache on Alpine Linux
Example PHP-FPM 8.2-apache setup for Docker, build on Alpine Linux.
The image is only +/- 25MB large.
Repository: https://git2.meramo.org/Infrastructure/alpine-phpfpm-nginx-baseimage.git
- Built on the lightweight and secure Alpine Linux distribution
- Very small Docker image size (+/-65MB)
- Uses PHP 8.2 for better performance, lower cpu usage & memory footprint
- Multi-arch support: 386, amd64, arm/v6, arm/v7, arm64, ppc64le, s390x
- Optimized for 100 concurrent users
- Optimized to only use resources when there's traffic (by using PHP-FPM's ondemand PM)
- Use of runit instead of supervisord to reduce memory footprint
- The servers Nginx, PHP-FPM run under a non-privileged user (nobody) to make it more secure
- The logs of all the services are redirected to the output of the Docker container (visible with
docker logs -f <container name>)
- Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs
Usage
Start the Docker container:
docker run -p 80:8080 kerstinsieren/alpine-phpfpm-nginx-baseimage
See the PHP info on http://localhost, or the static html page on http://localhost/test.html
Or mount your own code to be served by PHP-FPM & Nginx
docker run -p 8080:80 -v ~/my-codebase:/var/www/html kerstinsieren/alpine-phpfpm-nginx-baseimage