Skip to main content

Setting up PHP with GD2 image library in Docker

I put together some scripts to set up a dockerised PHP-Apache2 environment. Dockerhub actually has official images for this, but the problem is that they don't include the GD2 image library, you have to compile it in yourself. So, my scripts do that. They also create a persistent volume via a bindmount on the host machine, so that you can freely remove or rebuild the webserver container without losing your website data. By you can use a standard docker volume if you perfer.

SQLite is bundled with PHP on this image. If you need MySQL or some other database, then I suggest editing docker-compose.yml to add it as an additional service, running in its own container.

Precise instructions on how to set it up are provided, it's literally a 2 minute job. The system requirements are very low. I'm running it on a headless Raspberry Pi 4b attached to my home network via WIFI, and it is very fast. Download it here:


Copyright, all rights reserved.