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
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 (_).
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.
||Executes before the php.ini files are generated from the templates. This allows for adding additonal INI templates in
||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
The directories can have multiple shell scripts which are executed in alphabetical order.
It is recommended prefixing the scripts with a number, e.g.
COPY ./001_my-before-script.sh /etc/docker/hooks/config/pre/ COPY ./002_my-after-script.sh /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/
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 <firstname.lastname@example.org>" 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
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
- A manual test can be triggered via