Public Repository

Last pushed: 2 months ago
Short Description
A customised version of the offical image for php.
Full Description


A customised version of the offical image for php.

The image includes the extensions used across different hipages projects.


  • PHP configuration can be controlled via environment variables
  • Pre- and Post-configuration hooks for easier customisation
  • Custom INI templates

PHP Configuration

All PHP configuration parameters can be controlled via environment variables.
A list of all environment variables can be found in php.ini.template.

The syntax for the environment variables translates as follow:

All characters UPPERCASED, dots (.) replaced by underscores (_).


php.ini Environment
short_open_tag PHP_SHORT_OPEN_TAG
session.save_handler PHP_SESSION_SAVE_HANDLER

Pre- and Post-configuration hooks

The image allows to customisation via the entrypoint without the need to override the existing entrypoint script.

This is done via hooks that are executed at different stages in the entrypoint script.

Available Hooks:

Hook Directory Description
Pre-Configuration Hook /etc/docker/hooks/config/pre Executes before the php.ini files are generated from the templates. This allows for adding additonal INI templates in /usr/local/etc/php/conf.d.
Post-Configuration Hook /etc/docker/hooks/config/post Executes after PHP has been configured and before the actual PHP/PHP-FPM process runs.

The scripts need to end in .sh and need to be executable by /bin/sh.
The directories can have multiple shell scripts which are executed in alphabetical order.
It is recommended prefixing the scripts with a number, e.g.

Dockerfile Example:

COPY ./ /etc/docker/hooks/config/pre/
COPY ./ /etc/docker/hooks/config/post/

Custom INI templates

Additinonal INI templates can be placed in /usr/local/etc/php/conf.d allowing to customise the configuration process in case the existing php.ini.template doesn't provide the required option.

COPY ./my-custom-config.ini.template /usr/local/etc/php/conf.d/

The my-custom-config.ini.template will converted via the p2cli utility.
p2cli is using pongo2, a Django-syntax like template-engine.

Installation and usage

Get the PHP version of the container:

docker run -it --rm hipages/php:latest php -v

Access the container via shell:

docker run -it --rm hipages/php:latest /bin/sh

Extending the container:

FROM hipages/php:latest

LABEL maintainer "hipages DevOps Team <>"

VOLUME ["/var/www/html"]

COPY ./ /var/www/html/

Find more examples in the offical repository.

Tagging & Versioning

The following tags are being used for this image:

  • 7.1-fpm-alpine – Primary tag, being used for builds
  • build-<TRAVIS_BUILD_ID> – Used when build in travis
  • <PHP_VERSION>-fpm-alpine – Specific PHP version & container tag
  • 7-fpm-alpine – PHP major version tag
  • 7.1-fpm-alpine-<CONTAINER_VERSION> – Container version tag
  • php-<PHP_VERSION> – PHP Version tag

The container version is managed in VERSION.
If libraries or important parts of the container change this will be manually bumped up.

Build, Test & Release

The build, test & release process is managed via travis.
Each commit will trigger a build via travis and release the container.

  • A manual build can be triggered via make build.
  • A manual test can be triggered via make test.
Docker Pull Command