PHP Nginx Docker image
February 15, 2016
I created a Docker image to run a PHP application with PHP-FPM and Nginx. It’s meant as an example to copy and adjust to your needs. The Dockerfile should be easy to understand for everyone, and it should follow the best practices.
Features
- Built on the lightweight and secure Alpine Linux distribution
- Very small Docker image size (+/-40MB)
- Uses PHP 8.3 for better performance, lower CPU usage & memory footprint
- Optimized for 100 concurrent users
- Optimized to only use resources when there’s traffic (by using PHP-FPM’s on-demand PM)
- The servers Nginx, PHP-FPM and supervisord run under a non-privileged user (nobody) to make them more secure
- The logs of all the services are redirected to the output of the Docker container (visible with docker logs -f )
- Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs