Public | Automated Build

Last pushed: 2 years ago
Short Description
This is a minimalistic php-fpm Docker image based on Phusion base image with PHP 7.0.
Full Description


This is a minimalistic php-fpm Docker image based on Phusion base image.
The image provides the current PHP 7.0 version only.


To download the image run

docker pull geschke/php-fpm

This is a minimalistic approach to build a php-fpm environment. It doesn't
need configuration (and there is currently no way to modify the options
without inheriting the image).
Additional it installs the Composer dependency manager.

To start the container, just run a command like this:

docker run -d --name phpfpm -p \
     --volume /path/to/your/files/on/host:/var/www/html \

In the above example you will start a container named "phpfpm" which mounts
the volume /path/to/your/files/on/host to the internal directory
The -p option opens the port 9000 on localhost, so any Proxy or web server
can reach the php-fpm target. If you want to access from another server,
i.e. outside the current machine, just use the -p option without limiting
the host, e.g. -p 9000:9000. But beware if you expose the port like this - without a firewall your php-fpm
installation is open to the world!

Usage example with Nginx

To use Nginx, set up a configuration like this:

# pass the PHP scripts to FastCGI server listening on
location ~ \.php$ {
    # Use the tcp connection
    # ...but not the socket
    #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    include fastcgi.conf;

The example is from a working configuration of Nginx Ubuntu package. If not
set in the fastcgi.conf, maybe it's necessary to add the following options:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

These options are set as default in the fastcgi.conf file and could be
changed in the location settings.

At last, you have to configure the document root settings. Let's explain by
example. The PHP files on your host are installed in:


So the volume parameter when starting the container has to be:

-v /vol/www/phpapp1:/var/www/html

So inside the Docker container any of your PHP files could be reached within

Then you have to configure the document root as:

root /var/www/html;

in your Nginx sites configuration file, e.g.

You can change this behaviour if you modify the SCRIPT_FILENAME option in
the Nginx fastcgi options.


This image is based on Phusion baseimage, the Ubuntu PHP packages and uses
some configuration snippets of the official PHP Docker image. Thank you all!

Docker Pull Command
Source Repository