- Built on the lightweight and secure Alpine Linux distribution
- Very small Docker image size (+/-35MB)
- Uses PHP 8 for better performance, lower CPU usage & memory footprint
- Optimized for ~20 concurrent users
- Optimized to use low amount of resources when there's no traffic (by using PHP-FPM's dynamic PM)
- The servers Nginx, PHP-FPM and supervisord 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
- Composer
- WP-CLI
- GD2
- Various other extensions (like SimpleXML)
- MySQL CLI
This image is built on GitHub actions and hosted on the GitHub Docker images repo. It is also available under khromov/alpine-nginx-php8
on Docker Hub.
Fetch the prebuilt image in your custom images:
GitHub (preferred):
docker pull ghcr.io/khromov/alpine-nginx-php8/alpine-nginx-php8:latest
If you get "no basic auth credentials", see this page.
Docker Hub:
docker pull khromov/alpine-nginx-php8
This is convenient for developing Laravel, WordPress or Drupal sites. It includes MySQL and phpMyAdmin
docker-compose up
Now you can access your site at http://localhost:8080 and the MySQL database at db:3306
.
The folder ./src-compose
will be created and you can put your project files there.
The urls are:
- Web: http://localhost:8080
- phpMyAdmin: http://localhost:8081
If you copied files into ./src-compose
you need to run:
sudo chown -R nobody:nogroup ./src-compose
sudo chmod -R 777 ./src-compose
This makes sure that the files have the correct owner inside the container but remain writable outside of it.
docker build . -t php8
docker run -p 8080:8080 -t php8
Go to:
http://localhost:8080/
In config/ you'll find the default configuration files for Nginx, PHP and PHP-FPM. If you want to extend or customize that you can do so by mounting a configuration file in the correct folder.
This image was inspired by TrafeX/docker-php-nginx and this subsequent fork.