Back to top
1 minute read

Nginx-PHP-FPM Container Updates

Some big changes to the nginx-php-fpm container delivers a smaller image and PHP 7 support.

For those of you familiar with the nginx-php-fpm container we've recently introduced some great changes, but I'll start by explaining why this container is a little different to the normal containers out there. If you're impatient and want to pull this container straight away you can get it from here: Docker Hub

Git Integration

This is a core feature of this container, at heart it's a basic nginx and php container that works out of the box, however, the container can pull code from git and this makes it pretty unique and especially good for rapid development. This allows you to boot the bare container and have it automatically pull your code, getting your site up and running in seconds. Further to that you can use two commands within the container to commit code back to git or pull updates into the container that have been made elsewhere. The push code is great for WordPress sites as when you install or update plugins and themes you can simply commit the code back allowing you to rebuild the container easily if needed. 

Bootstrapping a container with code from git

To run the container you'll need to base64 a SSH deploy key that's linked to your git repository and supply the following arguments when starting your container. See the README for more details.

sudo docker run -d -e 'GIT_REPO=git@YOUR_GIT_REPO' -e 'SSH_KEY=BIG_LONG_BASE64_STRING_GOES_IN_HERE' richarvey/nginx-php-fpm:latest

Updating code in the container

You'll need some extra ENV vars enabled when you run the container to enable this feature. These are GIT_EMAIL and GIT_NAME, as well as the other git variables. See the README for more details.

Pushing code to git

To push code changes made within the container back to git simply run:

sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/push

Pulling code from Git (Refresh)

In order to refresh the code in a container and pull newer code from git simply run:

sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/pull

Recent Updates

Our latest updates are pretty major:

Alpine Linux

We moved from using Ubuntu 14.04 to Alpine Linux 3.4. This massively reduced the container footprint down to a 142.6MB image from a whooping 400MB. The container is now minimal, but fully functional!

PHP 7 support is here!

That's right we have PHP 7 support fully working. Just use the php7 tag instead of latest when pulling the image and you'll be up and running with all the new features PHP 7 brings.

Get it while its hot:

To get started:

Docker Hub:

To build your self or contribute:


Please do open issues, pull requests, comment or star the repository and help us grow the project to make it ever more useful.

Ric Harvey

Ric leads engineering and technical architecture for Ngineered. He has a vast amount of experience in cloud computing, having been responsible for the delivery of large-scale cloud migration projects at companies like Ticketmaster and Channel 4.