0% found this document useful (0 votes)
43 views61 pages

Dockerfile Readthedocs Io en Latest

The Dockerfile documentation provides an overview of Dockerfiles used for generating Docker images for various applications like PHP, Apache, and Nginx. It includes details on image hierarchy, environment variables, customization options, and known issues. The documentation is intended for users to understand how to utilize and contribute to the Dockerfiles effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views61 pages

Dockerfile Readthedocs Io en Latest

The Dockerfile documentation provides an overview of Dockerfiles used for generating Docker images for various applications like PHP, Apache, and Nginx. It includes details on image hierarchy, environment variables, customization options, and known issues. The documentation is intended for users to understand how to utilize and contribute to the Dockerfiles effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Dockerfile Documentation

Florian Tatzel

May 16, 2023


Contents

1 Introduction 3
1.1 What are the Dockerfile for? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Docker images 5
2.1 webdevops/apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 webdevops/base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 webdevops/base-app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 webdevops/bootstrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.5 webdevops/nginx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.6 webdevops/php . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.7 webdevops/php-apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.8 webdevops/php-apache-dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.9 webdevops/php-dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.10 webdevops/php-nginx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.11 webdevops/php-nginx-dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.12 webdevops/ssh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.13 webdevops/storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.14 webdevops/vsftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

3 Commands (bin/console) 47
3.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.2 Install dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.4 bin/console tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

4 Customization 51
4.1 Docker image tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2 Provisioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.3 Supervisor Daemon (Services) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

5 Known issues 55
5.1 General images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.2 PHP images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

6 FAQ 57

i
ii
Dockerfile Documentation

Welcome to the documentation pages for the WebDevOps Dockerfiles.

Here you will find informations regarding our Dockerfiles and how to use them.
This documentation is a work in progess and we appeciate every help we can get, so feel free to contribute.

Contents 1
Dockerfile Documentation

2 Contents
CHAPTER 1

Introduction

1.1 What are the Dockerfile for?

The Dockerfile repository is reponsible for generating our Docker images on https://hub.docker.com/u/webdevops/.
We’re generating Docker images for PHP, Apache, Nginx, Varnish or Sphinx.
All Docker images are generated by our Build server at https://build.webdevops.io/.

3
Dockerfile Documentation

4 Chapter 1. Introduction
CHAPTER 2

Docker images

Fig. 1: Docker image hierarchy

2.1 webdevops/apache

These image extends webdevops/base with a apache daemon which is running on port 80 and 443
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

5
Dockerfile Documentation

2.1.1 Docker image tags

Tag Distribution name


alpine Alpine
alpine-3 deprecated
ubuntu-12.04 deprecated
ubuntu-14.04 deprecated
ubuntu-15.04 deprecated
ubuntu-15.10 deprecated
ubuntu-16.04 deprecated
debian-7 deprecated
debian-8 deprecated
debian-9 deprecated
centos-7

2.1.2 Environment variables

Web environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for php-*
images)
SERVICE_PHPFPM_OPTS PHP-FPM command argu- empty (when php fpm is used)
ments
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
Nginx
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE 50m (when nginx is used)
client_max_body_size

2.1.3 Customization

Apache customization

This image has two directories for configuration files which will be automatic loaded.
For global configuration options the directory /opt/docker/etc/httpd/conf.d can be used. For vhost con-
figuration options the directory /opt/docker/etc/httpd/vhost.common.d can be used.
Any *.conf files inside these direcories will be included either global or the vhost section.

2.1.4 Docker image layout

6 Chapter 2. Docker images


Dockerfile Documentation

Apache layout

File/Directory Description
/opt/docker/etc/httpd/conf.d Main global configuration directory
(automatically included files)
/opt/docker/etc/httpd/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/httpd/conf.d/ Error document configuration
10-error-document.conf
/opt/docker/etc/httpd/conf.d/10-log.conf Log configuration
/opt/docker/etc/httpd/conf.d/10-server. Basic server configuration
conf
/opt/docker/etc/httpd/ssl SSL configuration directory for
certifications and keys
/opt/docker/etc/httpd/ssl/server.crt Example SSL certification (*.vm)
/opt/docker/etc/httpd/ssl/server.csr Example SSL certification request (*.vm)
/opt/docker/etc/httpd/ssl/server.key Example SSL key (*.vm)
/opt/docker/etc/httpd/vhost.common.d Vhost configuration directory
(automatically included files)
/opt/docker/etc/httpd/vhost.common.d/ Placeholder configuration file
01-boilerplate.conf (prevent include errors for Apache 2.2)
/opt/docker/etc/httpd/global.conf Global httpd configuration
/opt/docker/etc/httpd/main.conf Main httpd configuration
/opt/docker/etc/httpd/php.conf Deprecated PHP configuration
/opt/docker/etc/httpd/vhost.common.conf Deprecated vhost common include
/opt/docker/etc/httpd/vhost.conf Vhost configuration
/opt/docker/etc/httpd/vhost.ssl.conf Vhost SSL configuration
/opt/docker/etc/supervisor.d/httpd.conf Supervisord configuration file for Apache HTTPD

2.2 webdevops/base

Our application base container contains some general tools, the provisioning system (Ansible), a preconfgured modular
supervisord and a modular entrypoint script.
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

2.2. webdevops/base 7
Dockerfile Documentation

2.2.1 Docker image tags

Tag Distribution name


alpine Alpine
alpine-3 deprecated
ubuntu-12.04 deprecated
ubuntu-14.04 deprecated
ubuntu-15.04 deprecated
ubuntu-15.10 deprecated
ubuntu-16.04 deprecated
debian-7 deprecated
debian-8 deprecated
debian-9 deprecated
centos-7

2.2.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

2.2.3 Entrypoint

The entrypoint script is located in /opt/docker/bin/entrypoint.sh and will also start the entrypoint provi-
sioning before running the requested CMD.
Based on CMD the entrypoint script is trying to find the appropriate worker script located in /opt/docker/bin/
entrypoint.d and executes it. It must matches the CMD and if there is no appropriate worker script the entrypoint
falls back to /opt/docker/bin/entrypoint.d/default.sh which just executes the specified CMD.
This approach allows a modular entrypoint and also allows to directly jump into a container (eg. with docker run
-ti webdevops/apache bash) without uploading or modifing the entrypoint.
Example for starting supervisord (executed by entrypoint.d/supervisord.sh):

ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
CMD ["supervisord"]

8 Chapter 2. Docker images


Dockerfile Documentation

File/Directory Description
/opt/docker/bin/entrypoint.sh Entrypoint script for ENTRYPOINT instruction in Dock-
erfile
/opt/docker/bin/entrypoint.d/ Default worker script, will execute the defined cmd
default.sh
/opt/docker/bin/entrypoint.d/cli.sh Starts predefined CLI_SCRIPT (environment variable)
/opt/docker/bin/entrypoint.d/noop.sh Starts a noop endless loop at startup
/opt/docker/bin/entrypoint.d/root.sh Starts a root shell (deprecated)
/opt/docker/bin/entrypoint.d/ Starts supervisord daemon at startup (CMD
supervisord.sh ["supervisord"])

2.2.4 Supervisord

Supervisord is a lightweight daemon which starts and monitor other programs. We’re using it for running more than
one task in a docker container (eg. PHP-FPM and Apache/Nginx).

File/Directory Description
/opt/docker/etc/supervisor. Main supervisord configuration file
conf
/opt/docker/etc/supervisor. Modular service configuration files for supervisord (will be included
d/*.conf automatically)
/opt/docker/bin/servide.d/*. Service scripts if services needs more than just a single command
sh line for startup

2.2.5 Provisioning

With Ansible the provisioning tasks can be easliy done inside the Docker image (eg. for configurations and deploy-
ments). There is also a small provision script for registring and running Ansible roles.
For even simpler tasks there is also a possibility to upload small shell scripts which will be executed at the specific
tags.
Register a new role (eg. with tag build): /opt/docker/bin/provision add --tag build rolename
Run all registred roles and scripts (in Dockerfile): /opt/docker/bin/bootstrap.sh

Tag Description
bootstrap Run on Docker image creation (only run once)
build Run on Docker image build
onbuild Run on Docker image ONBUILD
entrypoint Run on Docker image entrypoint execution (only here Environment variables are available)

2.2. webdevops/base 9
Dockerfile Documentation

File/Directory Description
/opt/docker/bin/provision Provision script
/opt/docker/bin/bootstrap.sh Wrapper for running registred provisions (just run it as last script
in Dockerfile)
/opt/docker/provision/roles Directory for Ansible roles
/opt/docker/provision/ Directory for provisioning shell scripts (tag: bootstrap)
bootstrap.d/*.sh
/opt/docker/provision/build.d/ Directory for provisioning shell scripts (tag: build)
*.sh
/opt/docker/provision/onbuild. Directory for provisioning shell scripts (tag: onbuild)
d/*.sh
/opt/docker/provision/ Directory for provisioning shell scripts (tag: entrypoint)
entrypoint.d/*.sh

2.3 webdevops/base-app

The base-app image extends the base image with additional tools and all locales.
Packages:
• OpenSSH server (disabled by default) and client
• MySQL client
• sqlite
• dnsmasq (disabled by default)
• postfix (disabled by default)
• sudo
• zip, unzip, bzip2
• wget, curl
• net-tools
• moreutils
• dns utils
• rsync
• git
• nano, vim
Because some applications are using locales for translations (eg. date formatting) all locales are generated inside this
image.
For an example docker service

Attention: Alpine doesn’t provide any locales so you have to find another method for using locales!

Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

10 Chapter 2. Docker images


Dockerfile Documentation

2.3.1 Docker image tags

Tag Distribution name


alpine Alpine
alpine-3 deprecated
ubuntu-12.04 deprecated
ubuntu-14.04 deprecated
ubuntu-15.04 deprecated
ubuntu-15.10 deprecated
ubuntu-16.04 deprecated
debian-7 deprecated
debian-8 deprecated
debian-9 deprecated
centos-7

2.3.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

2.4 webdevops/bootstrap

Bootstrap images contains our baselayout (some basic scripts for secure and small package installations and handling)
and a basic toolset. It will also install Ansible into the container for future provisioning of the container.

2.4. webdevops/bootstrap 11
Dockerfile Documentation

2.4.1 Docker image tags

Tag Distribution name


alpine Alpine
alpine-3 deprecated
ubuntu-12.04 deprecated
ubuntu-14.04 deprecated
ubuntu-15.04 deprecated
ubuntu-15.10 deprecated
ubuntu-16.04 deprecated
debian-7 deprecated
debian-8 deprecated
debian-9 deprecated
centos-7

2.4.2 Baselayout scripts

File/Directory Description
/usr/local/bin/apk-install Alpine: Updates package cache, install packages and clears package
cache
/usr/local/bin/apk-upgrade Alpine: Run package upgrade
/usr/local/bin/apt-install Debian family: Updates package cache, install packages and clears
package cache
/usr/local/bin/apt-upgrade Debian family: Run package upgrade
/usr/local/bin/yum-install RedHat family: Updates package cache, install packages and clears
package cache
/usr/local/bin/yum-upgrade RedHat family: Run package upgrade
/usr/local/bin/ Generate locales
generate-locales
/usr/local/bin/rpl Script which can replace text in files
/usr/local/bin/service Supervisord service wrapper script (like service in Debian)

2.5 webdevops/nginx

These image extends webdevops/base with a nginx daemon which is running on port 80 and 443
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

12 Chapter 2. Docker images


Dockerfile Documentation

2.5.1 Docker image tags

Tag Distribution name


alpine Alpine
alpine-3 deprecated
ubuntu-12.04 deprecated
ubuntu-14.04 deprecated
ubuntu-15.04 deprecated
ubuntu-15.10 deprecated
ubuntu-16.04 deprecated
debian-7 deprecated
debian-8 deprecated
debian-9 deprecated
centos-7

2.5.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Web environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for php-*
images)
SERVICE_PHPFPM_OPTS PHP-FPM command argu- empty (when php fpm is used)
ments
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
Nginx
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE 50m (when nginx is used)
client_max_body_size

2.5.3 Customization

2.5. webdevops/nginx 13
Dockerfile Documentation

Nginx customization

This image has two directories for configuration files which will be automatic loaded.
For global configuration options the directory /opt/docker/etc/nginx/conf.d can be used. For vhost con-
figuration options the directory /opt/docker/etc/nginx/vhost.common.conf can be used.
Any *.conf files inside these direcories will be included either global or the vhost section.

2.5.4 Docker image layout

Nginx layout

File/Directory Description
/opt/docker/etc/nginx/conf.d Main global configuration directory
(automatically included files)
/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl SSL configuration directory for
certifications and keys
/opt/docker/etc/nginx/ssl/server.crt Example SSL certification (*.vm)
/opt/docker/etc/nginx/ssl/server.csr Example SSL certification request (*.vm)
/opt/docker/etc/nginx/ssl/server.key Example SSL key (*.vm)
/opt/docker/etc/nginx/vhost.common.d Vhost configuration directory
(automatically included files)
/opt/docker/etc/nginx/vhost.common.d/ Redirect requests to DOCUMENT_INDEX
10-location-root.conf
/opt/docker/etc/nginx/vhost.common.d/ PHP cgi configuration for vhost
10-php.conf
/opt/docker/etc/nginx/global.conf Global nginx configuration
/opt/docker/etc/nginx/main.conf Main Nginx configuration
/opt/docker/etc/nginx/php.conf Deprecated PHP configuration
/opt/docker/etc/nginx/vhost.common.conf Deprecated vhost common include
/opt/docker/etc/nginx/vhost.conf Vhost configuration
/opt/docker/etc/nginx/vhost.ssl.conf Vhost SSL configuration
/opt/docker/etc/supervisor.d/nginx.conf Supervisord configuration file for Nginx

2.6 webdevops/php

The php images are based on webdevops/base-app with PHP cli and PHP-FPM. PHP-FPM is running on port
9000.
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

2.6.1 Docker image tags

14 Chapter 2. Docker images


Dockerfile Documentation

Tag Distribution name PHP Version


5.6 deprecated PHP 5.6
7.0 deprecated PHP 7.0
7.1 deprecated PHP 7.1
7.2 deprecated PHP 7.2
7.3 deprecated PHP 7.3
7.4 customized official php image PHP 7.4
8.0 customized official php image PHP 8.0
8.1 customized official php image PHP 8.1
8.2 customized official php image PHP 8.2
7.1-alpine deprecated PHP 7.1
7.2-alpine deprecated PHP 7.2
7.3-alpine deprecated PHP 7.3
7.4-alpine customized official php image PHP 7.4
8.0-alpine customized official php image PHP 8.0
8.1-alpine customized official php image PHP 8.1
8.2-alpine customized official php image PHP 8.2
alpine deprecated PHP 7.x
alpine-php7 deprecated PHP 7.x
alpine-php5 deprecated PHP 5.6
alpine-3 deprecated PHP 5.6
alpine-3-php7 deprecated PHP 7.x
ubuntu-12.04 deprecated PHP 5.3
ubuntu-14.04 deprecated PHP 5.5
ubuntu-15.04 deprecated PHP 5.6
ubuntu-15.10 deprecated PHP 5.6
ubuntu-16.04 deprecated PHP 7.0
debian-7 deprecated PHP 5.4
debian-8 deprecated PHP 5.6
debian-8-php7 deprecated PHP 7.x (via sury)
debian-9 deprecated PHP 7.0
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

2.6.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

2.6. webdevops/php 15
Dockerfile Documentation

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

PHP modules

As we build our images containing almost every PHP module and having it activated by default, you might want to
deactivate some.
You can specify a comma-separated list of unwanted modules as dynamic env variable PHP_DISMOD, e.g.
PHP_DISMOD=ioncube,redis.

PHP.ini variables

You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit =
256M as php setting.

Environment variable Description Default


php.{setting-key} Sets the {setting-key} as php setting
PHP_DATE_TIMEZONE date.timezone UTC
PHP_DISPLAY_ERRORS display_errors 0
PHP_MEMORY_LIMIT memory_limit 512M
PHP_MAX_EXECUTION_TIME max_execution_time 300
PHP_POST_MAX_SIZE post_max_size 50M
PHP_UPLOAD_MAX_FILESIZE upload_max_filesize 50M
PHP_OPCACHE_MEMORY_CONSUMPTION opcache.memory_consumption 256
PHP_OPCACHE_MAX_ACCELERATED_FILES opcache.max_accelerated_files 7963
PHP_OPCACHE_VALIDATE_TIMESTAMPS opcache.validate_timestamps default
PHP_OPCACHE_REVALIDATE_FREQ opcache.revalidate_freq default
PHP_OPCACHE_INTERNED_STRINGS_BUFFER opcache.interned_strings_buffer 16

PHP FPM variables

You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.
max_requests = 1000 as fpm pool setting. The prefix fpm.pool is for pool settings and fpm.global for
global master process settings.

16 Chapter 2. Docker images


Dockerfile Documentation

Environment variable Description Default


fpm.global. Sets the {setting-key} as fpm global setting for
{setting-key} the master process
fpm.pool. Sets the {setting-key} as fpm pool setting
{setting-key}
FPM_PROCESS_MAX process.max distribution
default
FPM_PM_MAX_CHILDREN pm.max_children distribution
default
FPM_PM_START_SERVERS pm.start_servers distribution
default
FPM_PM_MIN_SPARE_SERVERSpm.min_spare_servers distribution
default
FPM_PM_MAX_SPARE_SERVERSpm.max_spare_servers distribution
default
FPM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout distribution
default
FPM_MAX_REQUESTS pm.max_requests distribution
default
FPM_REQUEST_TERMINATE_TIMEOUT
request_terminate_timeout distribution
default
FPM_RLIMIT_FILES rlimit_files distribution
default
FPM_RLIMIT_CORE rlimit_core distribution
default

Composer

Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.

Environment variable Description Default


COMPOSER_VERSION Specify the composer version to use 2

Be aware that this switch is only executed during container start (entrypoint). If you want to build your software with
a specific composer version, you can do this:

FROM webdevops/php-nginx:7.3
COPY ./src /app
RUN composer1 install -d /app

Or composer respectively.

2.6.3 Customization

PHP customization

For customization a placeholder /opt/docker/etc/php/php.ini is available which will be loaded as last


configuration file. All settings can be overwritten in this ini file.

2.6. webdevops/php 17
Dockerfile Documentation

Either use COPY inside your Dockerfile to overwrite this file or use RUN echo memory_limit = 128 M
>> /opt/docker/etc/php/php.ini to set specific php.ini values.

2.6.4 Docker image layout

PHP layout

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application. Application PHP-FPM pool configuration
conf file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-
FPM

2.7 webdevops/php-apache

These image extends webdevops/php with a apache daemon which is running on port 80 and 443
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

2.7.1 Docker image tags

Tag Distribution name PHP Version


5.6 deprecated PHP 5.6
7.0 deprecated PHP 7.0
7.1 deprecated PHP 7.1
7.2 deprecated PHP 7.2
7.3 deprecated PHP 7.3
7.4 customized official php image PHP 7.4
8.0 customized official php image PHP 8.0
8.1 customized official php image PHP 8.1
8.2 customized official php image PHP 8.2
7.1-alpine deprecated PHP 7.1
7.2-alpine deprecated PHP 7.2
7.3-alpine deprecated PHP 7.3
7.4-alpine customized official php image PHP 7.4
8.0-alpine customized official php image PHP 8.0
8.1-alpine customized official php image PHP 8.1
8.2-alpine customized official php image PHP 8.2
alpine deprecated PHP 7.x
alpine-php7 deprecated PHP 7.x
alpine-php5 deprecated PHP 5.6
alpine-3 deprecated PHP 5.6
Continued on next page

18 Chapter 2. Docker images


Dockerfile Documentation

Table 2 – continued from previous page


Tag Distribution name PHP Version
alpine-3-php7 deprecated PHP 7.x
ubuntu-12.04 deprecated PHP 5.3
ubuntu-14.04 deprecated PHP 5.5
ubuntu-15.04 deprecated PHP 5.6
ubuntu-15.10 deprecated PHP 5.6
ubuntu-16.04 deprecated PHP 7.0
debian-7 deprecated PHP 5.4
debian-8 deprecated PHP 5.6
debian-8-php7 deprecated PHP 7.x (via sury)
debian-9 deprecated PHP 7.0
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

2.7.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

2.7. webdevops/php-apache 19
Dockerfile Documentation

Web environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for php-*
images)
SERVICE_PHPFPM_OPTS PHP-FPM command argu- empty (when php fpm is used)
ments
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
Nginx
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE 50m (when nginx is used)
client_max_body_size

PHP modules

As we build our images containing almost every PHP module and having it activated by default, you might want to
deactivate some.
You can specify a comma-separated list of unwanted modules as dynamic env variable PHP_DISMOD, e.g.
PHP_DISMOD=ioncube,redis.

PHP.ini variables

You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit =
256M as php setting.

Environment variable Description Default


php.{setting-key} Sets the {setting-key} as php setting
PHP_DATE_TIMEZONE date.timezone UTC
PHP_DISPLAY_ERRORS display_errors 0
PHP_MEMORY_LIMIT memory_limit 512M
PHP_MAX_EXECUTION_TIME max_execution_time 300
PHP_POST_MAX_SIZE post_max_size 50M
PHP_UPLOAD_MAX_FILESIZE upload_max_filesize 50M
PHP_OPCACHE_MEMORY_CONSUMPTION opcache.memory_consumption 256
PHP_OPCACHE_MAX_ACCELERATED_FILES opcache.max_accelerated_files 7963
PHP_OPCACHE_VALIDATE_TIMESTAMPS opcache.validate_timestamps default
PHP_OPCACHE_REVALIDATE_FREQ opcache.revalidate_freq default
PHP_OPCACHE_INTERNED_STRINGS_BUFFER opcache.interned_strings_buffer 16

PHP FPM variables

You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.
max_requests = 1000 as fpm pool setting. The prefix fpm.pool is for pool settings and fpm.global for
global master process settings.

20 Chapter 2. Docker images


Dockerfile Documentation

Environment variable Description Default


fpm.global. Sets the {setting-key} as fpm global setting for
{setting-key} the master process
fpm.pool. Sets the {setting-key} as fpm pool setting
{setting-key}
FPM_PROCESS_MAX process.max distribution
default
FPM_PM_MAX_CHILDREN pm.max_children distribution
default
FPM_PM_START_SERVERS pm.start_servers distribution
default
FPM_PM_MIN_SPARE_SERVERSpm.min_spare_servers distribution
default
FPM_PM_MAX_SPARE_SERVERSpm.max_spare_servers distribution
default
FPM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout distribution
default
FPM_MAX_REQUESTS pm.max_requests distribution
default
FPM_REQUEST_TERMINATE_TIMEOUT
request_terminate_timeout distribution
default
FPM_RLIMIT_FILES rlimit_files distribution
default
FPM_RLIMIT_CORE rlimit_core distribution
default

Composer

Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.

Environment variable Description Default


COMPOSER_VERSION Specify the composer version to use 2

Be aware that this switch is only executed during container start (entrypoint). If you want to build your software with
a specific composer version, you can do this:

FROM webdevops/php-nginx:7.3
COPY ./src /app
RUN composer1 install -d /app

Or composer respectively.

2.7.3 Customization

PHP customization

For customization a placeholder /opt/docker/etc/php/php.ini is available which will be loaded as last


configuration file. All settings can be overwritten in this ini file.

2.7. webdevops/php-apache 21
Dockerfile Documentation

Either use COPY inside your Dockerfile to overwrite this file or use RUN echo memory_limit = 128 M
>> /opt/docker/etc/php/php.ini to set specific php.ini values.

Apache customization

This image has two directories for configuration files which will be automatic loaded.
For global configuration options the directory /opt/docker/etc/httpd/conf.d can be used. For vhost con-
figuration options the directory /opt/docker/etc/httpd/vhost.common.d can be used.
Any *.conf files inside these direcories will be included either global or the vhost section.

2.7.4 Docker image layout

Apache layout

File/Directory Description
/opt/docker/etc/httpd/conf.d Main global configuration directory
(automatically included files)
/opt/docker/etc/httpd/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/httpd/conf.d/ Error document configuration
10-error-document.conf
/opt/docker/etc/httpd/conf.d/10-log.conf Log configuration
/opt/docker/etc/httpd/conf.d/10-server. Basic server configuration
conf
/opt/docker/etc/httpd/ssl SSL configuration directory for
certifications and keys
/opt/docker/etc/httpd/ssl/server.crt Example SSL certification (*.vm)
/opt/docker/etc/httpd/ssl/server.csr Example SSL certification request (*.vm)
/opt/docker/etc/httpd/ssl/server.key Example SSL key (*.vm)
/opt/docker/etc/httpd/vhost.common.d Vhost configuration directory
(automatically included files)
/opt/docker/etc/httpd/vhost.common.d/ Placeholder configuration file
01-boilerplate.conf (prevent include errors for Apache 2.2)
/opt/docker/etc/httpd/global.conf Global httpd configuration
/opt/docker/etc/httpd/main.conf Main httpd configuration
/opt/docker/etc/httpd/php.conf Deprecated PHP configuration
/opt/docker/etc/httpd/vhost.common.conf Deprecated vhost common include
/opt/docker/etc/httpd/vhost.conf Vhost configuration
/opt/docker/etc/httpd/vhost.ssl.conf Vhost SSL configuration
/opt/docker/etc/supervisor.d/httpd.conf Supervisord configuration file for Apache HTTPD

22 Chapter 2. Docker images


Dockerfile Documentation

PHP layout

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application. Application PHP-FPM pool configuration
conf file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-
FPM

2.8 webdevops/php-apache-dev

These image extends webdevops/php-dev with a apache daemon which is running on port 80 and 443
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

Attention: PHP is running in development mode. Zend Opcode Cache is set to to revalidate files for best
development experience.

Tip: PHP-FPM is accessable by public port 9000

2.8.1 Docker image tags

Tag Distribution name PHP Version


5.6 deprecated PHP 5.6
7.0 deprecated PHP 7.0
7.1 deprecated PHP 7.1
7.2 deprecated PHP 7.2
7.3 deprecated PHP 7.3
7.4 customized official php image PHP 7.4
8.0 customized official php image PHP 8.0
8.1 customized official php image PHP 8.1
8.2 customized official php image PHP 8.2
7.1-alpine deprecated PHP 7.1
7.2-alpine deprecated PHP 7.2
7.3-alpine deprecated PHP 7.3
7.4-alpine customized official php image PHP 7.4
8.0-alpine customized official php image PHP 8.0
8.1-alpine customized official php image PHP 8.1
8.2-alpine customized official php image PHP 8.2
alpine deprecated PHP 7.x
Continued on next page

2.8. webdevops/php-apache-dev 23
Dockerfile Documentation

Table 3 – continued from previous page


Tag Distribution name PHP Version
alpine-php7 deprecated PHP 7.x
alpine-php5 deprecated PHP 5.6
alpine-3 deprecated PHP 5.6
alpine-3-php7 deprecated PHP 7.x
ubuntu-12.04 deprecated PHP 5.3
ubuntu-14.04 deprecated PHP 5.5
ubuntu-15.04 deprecated PHP 5.6
ubuntu-15.10 deprecated PHP 5.6
ubuntu-16.04 deprecated PHP 7.0
debian-7 deprecated PHP 5.4
debian-8 deprecated PHP 5.6
debian-8-php7 deprecated PHP 7.x (via sury)
debian-9 deprecated PHP 7.0
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

2.8.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

PHP modules

As we build our images containing almost every PHP module and having it activated by default, you might want to
deactivate some.
You can specify a comma-separated list of unwanted modules as dynamic env variable PHP_DISMOD, e.g.
PHP_DISMOD=ioncube,redis.

24 Chapter 2. Docker images


Dockerfile Documentation

PHP.ini variables

You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit =
256M as php setting.

Environment variable Description Default


php.{setting-key} Sets the {setting-key} as php setting
PHP_DATE_TIMEZONE date.timezone UTC
PHP_DISPLAY_ERRORS display_errors 0
PHP_MEMORY_LIMIT memory_limit 512M
PHP_MAX_EXECUTION_TIME max_execution_time 300
PHP_POST_MAX_SIZE post_max_size 50M
PHP_UPLOAD_MAX_FILESIZE upload_max_filesize 50M
PHP_OPCACHE_MEMORY_CONSUMPTION opcache.memory_consumption 256
PHP_OPCACHE_MAX_ACCELERATED_FILES opcache.max_accelerated_files 7963
PHP_OPCACHE_VALIDATE_TIMESTAMPS opcache.validate_timestamps default
PHP_OPCACHE_REVALIDATE_FREQ opcache.revalidate_freq default
PHP_OPCACHE_INTERNED_STRINGS_BUFFER opcache.interned_strings_buffer 16

PHP FPM variables

You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.
max_requests = 1000 as fpm pool setting. The prefix fpm.pool is for pool settings and fpm.global for
global master process settings.

Environment variable Description Default


fpm.global. Sets the {setting-key} as fpm global setting for
{setting-key} the master process
fpm.pool. Sets the {setting-key} as fpm pool setting
{setting-key}
FPM_PROCESS_MAX process.max distribution
default
FPM_PM_MAX_CHILDREN pm.max_children distribution
default
FPM_PM_START_SERVERS pm.start_servers distribution
default
FPM_PM_MIN_SPARE_SERVERSpm.min_spare_servers distribution
default
FPM_PM_MAX_SPARE_SERVERSpm.max_spare_servers distribution
default
FPM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout distribution
default
FPM_MAX_REQUESTS pm.max_requests distribution
default
FPM_REQUEST_TERMINATE_TIMEOUT
request_terminate_timeout distribution
default
FPM_RLIMIT_FILES rlimit_files distribution
default
FPM_RLIMIT_CORE rlimit_core distribution
default

2.8. webdevops/php-apache-dev 25
Dockerfile Documentation

Composer

Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.

Environment variable Description Default


COMPOSER_VERSION Specify the composer version to use 2

Be aware that this switch is only executed during container start (entrypoint). If you want to build your software with
a specific composer version, you can do this:

FROM webdevops/php-nginx:7.3
COPY ./src /app
RUN composer1 install -d /app

Or composer respectively.

26 Chapter 2. Docker images


Dockerfile Documentation

PHP development environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for
php-* images)
WEB_NO_CACHE_PATTERN RegExp of files which should be delivered by \.
webserver as non cacheable to browser (css|js|gif|png|jpg|svg|json|xml)$
PHP_DEBUGGER Specifies which php debugger should be active xdebug (eg. xdebug,
blackfire or none)
XDEBUG_MODE php.ini value for xdebug.mode none
php.ini
XDEBUG_START_WITH_REQUEST value for xdebug. none
start_with_request
XDEBUG_REMOTE_AUTOSTARTphp.ini value for xdebug. none
remote_autostart
php.ini
XDEBUG_REMOTE_CONNECT_BACK value for xdebug. none
remote_connect_back
php.ini
XDEBUG_DISCOVER_CLIENT_HOST value for xdebug. none
discover_client_host
XDEBUG_CLIENT_HOST php.ini value for xdebug.client_host none
XDEBUG_CLIENT_PORT php.ini value for xdebug.client_port none
XDEBUG_REMOTE_HOST php.ini value for xdebug.remote_host none
XDEBUG_REMOTE_PORT php.ini value for xdebug.remote_port none
php.ini
XDEBUG_MAX_NESTING_LEVEL value for xdebug. none
max_nesting_level
XDEBUG_IDE_KEY php.ini value for xdebug.idekey none
XDEBUG_PROFILER_ENABLE php.ini value for xdebug. none
profiler_enable
php.ini
XDEBUG_PROFILER_ENABLE_TRIGGER value for xdebug. none
profiler_enable_trigger
XDEBUG_TRIGGER_VALUE php.ini value for xdebug.trigger_value none
XDEBUG_OUTPUT_DIR php.ini value for xdebug.output_dir none
php.ini
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE value for xdebug. none
profiler_enable_trigger_value
php.ini
XDEBUG_PROFILER_OUTPUT_DIR value for xdebug. none
profiler_output_dir
php.ini
XDEBUG_PROFILER_OUTPUT_NAME value for xdebug. none
profiler_output_name
BLACKFIRE_SERVER_ID php.ini value for blackfire.server_id none
BLACKFIRE_SERVER_TOKEN php.ini value for blackfire. none
server_token
Blackfire agent command arguments
SERVICE_BLACKFIRE_AGENT_OPTS empty

Please be aware that depending of the image you are using it can contain either xdebug2 or xdebug3. You can find the
necessary configuration options according to your xdebug version here: https://xdebug.org/docs/upgrade_guide

2.8.3 Customization

2.8. webdevops/php-apache-dev 27
Dockerfile Documentation

PHP customization

For customization a placeholder /opt/docker/etc/php/php.ini is available which will be loaded as last


configuration file. All settings can be overwritten in this ini file.
Either use COPY inside your Dockerfile to overwrite this file or use RUN echo memory_limit = 128 M
>> /opt/docker/etc/php/php.ini to set specific php.ini values.

Apache customization

This image has two directories for configuration files which will be automatic loaded.
For global configuration options the directory /opt/docker/etc/httpd/conf.d can be used. For vhost con-
figuration options the directory /opt/docker/etc/httpd/vhost.common.d can be used.
Any *.conf files inside these direcories will be included either global or the vhost section.

2.8.4 Docker image layout

Apache layout

File/Directory Description
/opt/docker/etc/httpd/conf.d Main global configuration directory
(automatically included files)
/opt/docker/etc/httpd/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/httpd/conf.d/ Error document configuration
10-error-document.conf
/opt/docker/etc/httpd/conf.d/10-log.conf Log configuration
/opt/docker/etc/httpd/conf.d/10-server. Basic server configuration
conf
/opt/docker/etc/httpd/ssl SSL configuration directory for
certifications and keys
/opt/docker/etc/httpd/ssl/server.crt Example SSL certification (*.vm)
/opt/docker/etc/httpd/ssl/server.csr Example SSL certification request (*.vm)
/opt/docker/etc/httpd/ssl/server.key Example SSL key (*.vm)
/opt/docker/etc/httpd/vhost.common.d Vhost configuration directory
(automatically included files)
/opt/docker/etc/httpd/vhost.common.d/ Placeholder configuration file
01-boilerplate.conf (prevent include errors for Apache 2.2)
/opt/docker/etc/httpd/global.conf Global httpd configuration
/opt/docker/etc/httpd/main.conf Main httpd configuration
/opt/docker/etc/httpd/php.conf Deprecated PHP configuration
/opt/docker/etc/httpd/vhost.common.conf Deprecated vhost common include
/opt/docker/etc/httpd/vhost.conf Vhost configuration
/opt/docker/etc/httpd/vhost.ssl.conf Vhost SSL configuration
/opt/docker/etc/supervisor.d/httpd.conf Supervisord configuration file for Apache HTTPD

28 Chapter 2. Docker images


Dockerfile Documentation

PHP layout

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application. Application PHP-FPM pool configuration
conf file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-
FPM

2.9 webdevops/php-dev

These image extends webdevops/php with xdebug and development tools


Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

Attention: PHP is running in development mode. Zend Opcode Cache is set to to revalidate files for best
development experience.

Tip: PHP-FPM is accessable by public port 9000

2.9.1 Docker image tags

Tag Distribution name PHP Version


5.6 deprecated PHP 5.6
7.0 deprecated PHP 7.0
7.1 deprecated PHP 7.1
7.2 deprecated PHP 7.2
7.3 deprecated PHP 7.3
7.4 customized official php image PHP 7.4
8.0 customized official php image PHP 8.0
8.1 customized official php image PHP 8.1
8.2 customized official php image PHP 8.2
7.1-alpine deprecated PHP 7.1
7.2-alpine deprecated PHP 7.2
7.3-alpine deprecated PHP 7.3
7.4-alpine customized official php image PHP 7.4
8.0-alpine customized official php image PHP 8.0
8.1-alpine customized official php image PHP 8.1
8.2-alpine customized official php image PHP 8.2
alpine deprecated PHP 7.x
Continued on next page

2.9. webdevops/php-dev 29
Dockerfile Documentation

Table 4 – continued from previous page


Tag Distribution name PHP Version
alpine-php7 deprecated PHP 7.x
alpine-php5 deprecated PHP 5.6
alpine-3 deprecated PHP 5.6
alpine-3-php7 deprecated PHP 7.x
ubuntu-12.04 deprecated PHP 5.3
ubuntu-14.04 deprecated PHP 5.5
ubuntu-15.04 deprecated PHP 5.6
ubuntu-15.10 deprecated PHP 5.6
ubuntu-16.04 deprecated PHP 7.0
debian-7 deprecated PHP 5.4
debian-8 deprecated PHP 5.6
debian-8-php7 deprecated PHP 7.x (via sury)
debian-9 deprecated PHP 7.0
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

2.9.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

PHP modules

As we build our images containing almost every PHP module and having it activated by default, you might want to
deactivate some.
You can specify a comma-separated list of unwanted modules as dynamic env variable PHP_DISMOD, e.g.
PHP_DISMOD=ioncube,redis.

30 Chapter 2. Docker images


Dockerfile Documentation

PHP.ini variables

You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit =
256M as php setting.

Environment variable Description Default


php.{setting-key} Sets the {setting-key} as php setting
PHP_DATE_TIMEZONE date.timezone UTC
PHP_DISPLAY_ERRORS display_errors 0
PHP_MEMORY_LIMIT memory_limit 512M
PHP_MAX_EXECUTION_TIME max_execution_time 300
PHP_POST_MAX_SIZE post_max_size 50M
PHP_UPLOAD_MAX_FILESIZE upload_max_filesize 50M
PHP_OPCACHE_MEMORY_CONSUMPTION opcache.memory_consumption 256
PHP_OPCACHE_MAX_ACCELERATED_FILES opcache.max_accelerated_files 7963
PHP_OPCACHE_VALIDATE_TIMESTAMPS opcache.validate_timestamps default
PHP_OPCACHE_REVALIDATE_FREQ opcache.revalidate_freq default
PHP_OPCACHE_INTERNED_STRINGS_BUFFER opcache.interned_strings_buffer 16

PHP FPM variables

You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.
max_requests = 1000 as fpm pool setting. The prefix fpm.pool is for pool settings and fpm.global for
global master process settings.

Environment variable Description Default


fpm.global. Sets the {setting-key} as fpm global setting for
{setting-key} the master process
fpm.pool. Sets the {setting-key} as fpm pool setting
{setting-key}
FPM_PROCESS_MAX process.max distribution
default
FPM_PM_MAX_CHILDREN pm.max_children distribution
default
FPM_PM_START_SERVERS pm.start_servers distribution
default
FPM_PM_MIN_SPARE_SERVERSpm.min_spare_servers distribution
default
FPM_PM_MAX_SPARE_SERVERSpm.max_spare_servers distribution
default
FPM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout distribution
default
FPM_MAX_REQUESTS pm.max_requests distribution
default
FPM_REQUEST_TERMINATE_TIMEOUT
request_terminate_timeout distribution
default
FPM_RLIMIT_FILES rlimit_files distribution
default
FPM_RLIMIT_CORE rlimit_core distribution
default

2.9. webdevops/php-dev 31
Dockerfile Documentation

Composer

Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.

Environment variable Description Default


COMPOSER_VERSION Specify the composer version to use 2

Be aware that this switch is only executed during container start (entrypoint). If you want to build your software with
a specific composer version, you can do this:

FROM webdevops/php-nginx:7.3
COPY ./src /app
RUN composer1 install -d /app

Or composer respectively.

32 Chapter 2. Docker images


Dockerfile Documentation

PHP development environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for
php-* images)
WEB_NO_CACHE_PATTERN RegExp of files which should be delivered by \.
webserver as non cacheable to browser (css|js|gif|png|jpg|svg|json|xml)$
PHP_DEBUGGER Specifies which php debugger should be active xdebug (eg. xdebug,
blackfire or none)
XDEBUG_MODE php.ini value for xdebug.mode none
php.ini
XDEBUG_START_WITH_REQUEST value for xdebug. none
start_with_request
XDEBUG_REMOTE_AUTOSTARTphp.ini value for xdebug. none
remote_autostart
php.ini
XDEBUG_REMOTE_CONNECT_BACK value for xdebug. none
remote_connect_back
php.ini
XDEBUG_DISCOVER_CLIENT_HOST value for xdebug. none
discover_client_host
XDEBUG_CLIENT_HOST php.ini value for xdebug.client_host none
XDEBUG_CLIENT_PORT php.ini value for xdebug.client_port none
XDEBUG_REMOTE_HOST php.ini value for xdebug.remote_host none
XDEBUG_REMOTE_PORT php.ini value for xdebug.remote_port none
php.ini
XDEBUG_MAX_NESTING_LEVEL value for xdebug. none
max_nesting_level
XDEBUG_IDE_KEY php.ini value for xdebug.idekey none
XDEBUG_PROFILER_ENABLE php.ini value for xdebug. none
profiler_enable
php.ini
XDEBUG_PROFILER_ENABLE_TRIGGER value for xdebug. none
profiler_enable_trigger
XDEBUG_TRIGGER_VALUE php.ini value for xdebug.trigger_value none
XDEBUG_OUTPUT_DIR php.ini value for xdebug.output_dir none
php.ini
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE value for xdebug. none
profiler_enable_trigger_value
php.ini
XDEBUG_PROFILER_OUTPUT_DIR value for xdebug. none
profiler_output_dir
php.ini
XDEBUG_PROFILER_OUTPUT_NAME value for xdebug. none
profiler_output_name
BLACKFIRE_SERVER_ID php.ini value for blackfire.server_id none
BLACKFIRE_SERVER_TOKEN php.ini value for blackfire. none
server_token
Blackfire agent command arguments
SERVICE_BLACKFIRE_AGENT_OPTS empty

Please be aware that depending of the image you are using it can contain either xdebug2 or xdebug3. You can find the
necessary configuration options according to your xdebug version here: https://xdebug.org/docs/upgrade_guide

2.9.3 Customization

2.9. webdevops/php-dev 33
Dockerfile Documentation

PHP customization

For customization a placeholder /opt/docker/etc/php/php.ini is available which will be loaded as last


configuration file. All settings can be overwritten in this ini file.
Either use COPY inside your Dockerfile to overwrite this file or use RUN echo memory_limit = 128 M
>> /opt/docker/etc/php/php.ini to set specific php.ini values.

2.9.4 Docker image layout

PHP layout

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application. Application PHP-FPM pool configuration
conf file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-
FPM

2.10 webdevops/php-nginx

These image extends webdevops/php with a nginx daemon which is running on port 80 and 443
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

2.10.1 Docker image tags

Tag Distribution name PHP Version


5.6 deprecated PHP 5.6
7.0 deprecated PHP 7.0
7.1 deprecated PHP 7.1
7.2 deprecated PHP 7.2
7.3 deprecated PHP 7.3
7.4 customized official php image PHP 7.4
8.0 customized official php image PHP 8.0
8.1 customized official php image PHP 8.1
8.2 customized official php image PHP 8.2
7.1-alpine deprecated PHP 7.1
7.2-alpine deprecated PHP 7.2
7.3-alpine deprecated PHP 7.3
7.4-alpine customized official php image PHP 7.4
8.0-alpine customized official php image PHP 8.0
8.1-alpine customized official php image PHP 8.1
Continued on next page

34 Chapter 2. Docker images


Dockerfile Documentation

Table 5 – continued from previous page


Tag Distribution name PHP Version
8.2-alpine customized official php image PHP 8.2
alpine deprecated PHP 7.x
alpine-php7 deprecated PHP 7.x
alpine-php5 deprecated PHP 5.6
alpine-3 deprecated PHP 5.6
alpine-3-php7 deprecated PHP 7.x
ubuntu-12.04 deprecated PHP 5.3
ubuntu-14.04 deprecated PHP 5.5
ubuntu-15.04 deprecated PHP 5.6
ubuntu-15.10 deprecated PHP 5.6
ubuntu-16.04 deprecated PHP 7.0
debian-7 deprecated PHP 5.4
debian-8 deprecated PHP 5.6
debian-8-php7 deprecated PHP 7.x (via sury)
debian-9 deprecated PHP 7.0
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

2.10.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

2.10. webdevops/php-nginx 35
Dockerfile Documentation

Web environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for php-*
images)
SERVICE_PHPFPM_OPTS PHP-FPM command argu- empty (when php fpm is used)
ments
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
Nginx
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE 50m (when nginx is used)
client_max_body_size

PHP modules

As we build our images containing almost every PHP module and having it activated by default, you might want to
deactivate some.
You can specify a comma-separated list of unwanted modules as dynamic env variable PHP_DISMOD, e.g.
PHP_DISMOD=ioncube,redis.

PHP.ini variables

You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit =
256M as php setting.

Environment variable Description Default


php.{setting-key} Sets the {setting-key} as php setting
PHP_DATE_TIMEZONE date.timezone UTC
PHP_DISPLAY_ERRORS display_errors 0
PHP_MEMORY_LIMIT memory_limit 512M
PHP_MAX_EXECUTION_TIME max_execution_time 300
PHP_POST_MAX_SIZE post_max_size 50M
PHP_UPLOAD_MAX_FILESIZE upload_max_filesize 50M
PHP_OPCACHE_MEMORY_CONSUMPTION opcache.memory_consumption 256
PHP_OPCACHE_MAX_ACCELERATED_FILES opcache.max_accelerated_files 7963
PHP_OPCACHE_VALIDATE_TIMESTAMPS opcache.validate_timestamps default
PHP_OPCACHE_REVALIDATE_FREQ opcache.revalidate_freq default
PHP_OPCACHE_INTERNED_STRINGS_BUFFER opcache.interned_strings_buffer 16

PHP FPM variables

You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.
max_requests = 1000 as fpm pool setting. The prefix fpm.pool is for pool settings and fpm.global for
global master process settings.

36 Chapter 2. Docker images


Dockerfile Documentation

Environment variable Description Default


fpm.global. Sets the {setting-key} as fpm global setting for
{setting-key} the master process
fpm.pool. Sets the {setting-key} as fpm pool setting
{setting-key}
FPM_PROCESS_MAX process.max distribution
default
FPM_PM_MAX_CHILDREN pm.max_children distribution
default
FPM_PM_START_SERVERS pm.start_servers distribution
default
FPM_PM_MIN_SPARE_SERVERSpm.min_spare_servers distribution
default
FPM_PM_MAX_SPARE_SERVERSpm.max_spare_servers distribution
default
FPM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout distribution
default
FPM_MAX_REQUESTS pm.max_requests distribution
default
FPM_REQUEST_TERMINATE_TIMEOUT
request_terminate_timeout distribution
default
FPM_RLIMIT_FILES rlimit_files distribution
default
FPM_RLIMIT_CORE rlimit_core distribution
default

Composer

Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.

Environment variable Description Default


COMPOSER_VERSION Specify the composer version to use 2

Be aware that this switch is only executed during container start (entrypoint). If you want to build your software with
a specific composer version, you can do this:

FROM webdevops/php-nginx:7.3
COPY ./src /app
RUN composer1 install -d /app

Or composer respectively.

2.10.3 Customization

PHP customization

For customization a placeholder /opt/docker/etc/php/php.ini is available which will be loaded as last


configuration file. All settings can be overwritten in this ini file.

2.10. webdevops/php-nginx 37
Dockerfile Documentation

Either use COPY inside your Dockerfile to overwrite this file or use RUN echo memory_limit = 128 M
>> /opt/docker/etc/php/php.ini to set specific php.ini values.

Nginx customization

This image has two directories for configuration files which will be automatic loaded.
For global configuration options the directory /opt/docker/etc/nginx/conf.d can be used. For vhost con-
figuration options the directory /opt/docker/etc/nginx/vhost.common.conf can be used.
Any *.conf files inside these direcories will be included either global or the vhost section.

2.10.4 Docker image layout

Nginx layout

File/Directory Description
/opt/docker/etc/nginx/conf.d Main global configuration directory
(automatically included files)
/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl SSL configuration directory for
certifications and keys
/opt/docker/etc/nginx/ssl/server.crt Example SSL certification (*.vm)
/opt/docker/etc/nginx/ssl/server.csr Example SSL certification request (*.vm)
/opt/docker/etc/nginx/ssl/server.key Example SSL key (*.vm)
/opt/docker/etc/nginx/vhost.common.d Vhost configuration directory
(automatically included files)
/opt/docker/etc/nginx/vhost.common.d/ Redirect requests to DOCUMENT_INDEX
10-location-root.conf
/opt/docker/etc/nginx/vhost.common.d/ PHP cgi configuration for vhost
10-php.conf
/opt/docker/etc/nginx/global.conf Global nginx configuration
/opt/docker/etc/nginx/main.conf Main Nginx configuration
/opt/docker/etc/nginx/php.conf Deprecated PHP configuration
/opt/docker/etc/nginx/vhost.common.conf Deprecated vhost common include
/opt/docker/etc/nginx/vhost.conf Vhost configuration
/opt/docker/etc/nginx/vhost.ssl.conf Vhost SSL configuration
/opt/docker/etc/supervisor.d/nginx.conf Supervisord configuration file for Nginx

PHP layout

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application. Application PHP-FPM pool configuration
conf file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-
FPM

38 Chapter 2. Docker images


Dockerfile Documentation

2.11 webdevops/php-nginx-dev

These image extends webdevops/php-dev with a nginx daemon which is running on port 80 and 443
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

Attention: PHP is running in development mode. Zend Opcode Cache is set to to revalidate files for best
development experience.

Tip: PHP-FPM is accessable by public port 9000

2.11.1 Docker image tags

Tag Distribution name PHP Version


5.6 deprecated PHP 5.6
7.0 deprecated PHP 7.0
7.1 deprecated PHP 7.1
7.2 deprecated PHP 7.2
7.3 deprecated PHP 7.3
7.4 customized official php image PHP 7.4
8.0 customized official php image PHP 8.0
8.1 customized official php image PHP 8.1
8.2 customized official php image PHP 8.2
7.1-alpine deprecated PHP 7.1
7.2-alpine deprecated PHP 7.2
7.3-alpine deprecated PHP 7.3
7.4-alpine customized official php image PHP 7.4
8.0-alpine customized official php image PHP 8.0
8.1-alpine customized official php image PHP 8.1
8.2-alpine customized official php image PHP 8.2
alpine deprecated PHP 7.x
alpine-php7 deprecated PHP 7.x
alpine-php5 deprecated PHP 5.6
alpine-3 deprecated PHP 5.6
alpine-3-php7 deprecated PHP 7.x
ubuntu-12.04 deprecated PHP 5.3
ubuntu-14.04 deprecated PHP 5.5
ubuntu-15.04 deprecated PHP 5.6
ubuntu-15.10 deprecated PHP 5.6
ubuntu-16.04 deprecated PHP 7.0
debian-7 deprecated PHP 5.4
debian-8 deprecated PHP 5.6
debian-8-php7 deprecated PHP 7.x (via sury)
debian-9 deprecated PHP 7.0
Continued on next page

2.11. webdevops/php-nginx-dev 39
Dockerfile Documentation

Table 6 – continued from previous page


Tag Distribution name PHP Version
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

2.11.2 Environment variables

Base environment variables

Environment variable Description Default


LOG_STDOUT Destination of daemon output empty (stdout)
LOG_STDERR Destination of daemon errors empty (stdout)
SERVICE_CRON_OPTS cron daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_OPTS dnsmasq daemon arguments empty (when syslog is used)
SERVICE_DNSMASQ_USER dnsmasq effective user root
SERVICE_POSTFIX_OPTS postfix daemon arguments empty (when syslog is used)
SERVICE_SSH_OPTS ssh daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_OPTS supervisor daemon arguments empty (when syslog is used)
SERVICE_SUPERVISOR_USER supervisor effective user root
SERVICE_SYSLOG_OPTS syslog daemon arguments empty (when syslog is used)

Base environment variables

Environment variable Description Default


POSTFIX_MYNETWORKS Postfix mynetworks address empty
POSTFIX_RELAYHOST Postfix upstream relay server empty

PHP modules

As we build our images containing almost every PHP module and having it activated by default, you might want to
deactivate some.
You can specify a comma-separated list of unwanted modules as dynamic env variable PHP_DISMOD, e.g.
PHP_DISMOD=ioncube,redis.

PHP.ini variables

You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit =
256M as php setting.

40 Chapter 2. Docker images


Dockerfile Documentation

Environment variable Description Default


php.{setting-key} Sets the {setting-key} as php setting
PHP_DATE_TIMEZONE date.timezone UTC
PHP_DISPLAY_ERRORS display_errors 0
PHP_MEMORY_LIMIT memory_limit 512M
PHP_MAX_EXECUTION_TIME max_execution_time 300
PHP_POST_MAX_SIZE post_max_size 50M
PHP_UPLOAD_MAX_FILESIZE upload_max_filesize 50M
PHP_OPCACHE_MEMORY_CONSUMPTION opcache.memory_consumption 256
PHP_OPCACHE_MAX_ACCELERATED_FILES opcache.max_accelerated_files 7963
PHP_OPCACHE_VALIDATE_TIMESTAMPS opcache.validate_timestamps default
PHP_OPCACHE_REVALIDATE_FREQ opcache.revalidate_freq default
PHP_OPCACHE_INTERNED_STRINGS_BUFFER opcache.interned_strings_buffer 16

PHP FPM variables

You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.
max_requests = 1000 as fpm pool setting. The prefix fpm.pool is for pool settings and fpm.global for
global master process settings.

Environment variable Description Default


fpm.global. Sets the {setting-key} as fpm global setting for
{setting-key} the master process
fpm.pool. Sets the {setting-key} as fpm pool setting
{setting-key}
FPM_PROCESS_MAX process.max distribution
default
FPM_PM_MAX_CHILDREN pm.max_children distribution
default
FPM_PM_START_SERVERS pm.start_servers distribution
default
FPM_PM_MIN_SPARE_SERVERSpm.min_spare_servers distribution
default
FPM_PM_MAX_SPARE_SERVERSpm.max_spare_servers distribution
default
FPM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout distribution
default
FPM_MAX_REQUESTS pm.max_requests distribution
default
FPM_REQUEST_TERMINATE_TIMEOUT
request_terminate_timeout distribution
default
FPM_RLIMIT_FILES rlimit_files distribution
default
FPM_RLIMIT_CORE rlimit_core distribution
default

Composer

Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.

2.11. webdevops/php-nginx-dev 41
Dockerfile Documentation

Environment variable Description Default


COMPOSER_VERSION Specify the composer version to use 2

Be aware that this switch is only executed during container start (entrypoint). If you want to build your software with
a specific composer version, you can do this:

FROM webdevops/php-nginx:7.3
COPY ./src /app
RUN composer1 install -d /app

Or composer respectively.

42 Chapter 2. Docker images


Dockerfile Documentation

PHP development environment variables

Environment variable Description Default


WEB_DOCUMENT_ROOT Document root for webserver /app
WEB_DOCUMENT_INDEX Index document index.php
WEB_ALIAS_DOMAIN Domain aliases *.vm
WEB_PHP_SOCKET PHP-FPM socket address 127.0.0.1:9000 (for
php-* images)
WEB_NO_CACHE_PATTERN RegExp of files which should be delivered by \.
webserver as non cacheable to browser (css|js|gif|png|jpg|svg|json|xml)$
PHP_DEBUGGER Specifies which php debugger should be active xdebug (eg. xdebug,
blackfire or none)
XDEBUG_MODE php.ini value for xdebug.mode none
php.ini
XDEBUG_START_WITH_REQUEST value for xdebug. none
start_with_request
XDEBUG_REMOTE_AUTOSTARTphp.ini value for xdebug. none
remote_autostart
php.ini
XDEBUG_REMOTE_CONNECT_BACK value for xdebug. none
remote_connect_back
php.ini
XDEBUG_DISCOVER_CLIENT_HOST value for xdebug. none
discover_client_host
XDEBUG_CLIENT_HOST php.ini value for xdebug.client_host none
XDEBUG_CLIENT_PORT php.ini value for xdebug.client_port none
XDEBUG_REMOTE_HOST php.ini value for xdebug.remote_host none
XDEBUG_REMOTE_PORT php.ini value for xdebug.remote_port none
php.ini
XDEBUG_MAX_NESTING_LEVEL value for xdebug. none
max_nesting_level
XDEBUG_IDE_KEY php.ini value for xdebug.idekey none
XDEBUG_PROFILER_ENABLE php.ini value for xdebug. none
profiler_enable
php.ini
XDEBUG_PROFILER_ENABLE_TRIGGER value for xdebug. none
profiler_enable_trigger
XDEBUG_TRIGGER_VALUE php.ini value for xdebug.trigger_value none
XDEBUG_OUTPUT_DIR php.ini value for xdebug.output_dir none
php.ini
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE value for xdebug. none
profiler_enable_trigger_value
php.ini
XDEBUG_PROFILER_OUTPUT_DIR value for xdebug. none
profiler_output_dir
php.ini
XDEBUG_PROFILER_OUTPUT_NAME value for xdebug. none
profiler_output_name
BLACKFIRE_SERVER_ID php.ini value for blackfire.server_id none
BLACKFIRE_SERVER_TOKEN php.ini value for blackfire. none
server_token
Blackfire agent command arguments
SERVICE_BLACKFIRE_AGENT_OPTS empty

Please be aware that depending of the image you are using it can contain either xdebug2 or xdebug3. You can find the
necessary configuration options according to your xdebug version here: https://xdebug.org/docs/upgrade_guide

2.11.3 Customization

2.11. webdevops/php-nginx-dev 43
Dockerfile Documentation

PHP customization

For customization a placeholder /opt/docker/etc/php/php.ini is available which will be loaded as last


configuration file. All settings can be overwritten in this ini file.
Either use COPY inside your Dockerfile to overwrite this file or use RUN echo memory_limit = 128 M
>> /opt/docker/etc/php/php.ini to set specific php.ini values.

Nginx customization

This image has two directories for configuration files which will be automatic loaded.
For global configuration options the directory /opt/docker/etc/nginx/conf.d can be used. For vhost con-
figuration options the directory /opt/docker/etc/nginx/vhost.common.conf can be used.
Any *.conf files inside these direcories will be included either global or the vhost section.

2.11.4 Docker image layout

Nginx layout

File/Directory Description
/opt/docker/etc/nginx/conf.d Main global configuration directory
(automatically included files)
/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl SSL configuration directory for
certifications and keys
/opt/docker/etc/nginx/ssl/server.crt Example SSL certification (*.vm)
/opt/docker/etc/nginx/ssl/server.csr Example SSL certification request (*.vm)
/opt/docker/etc/nginx/ssl/server.key Example SSL key (*.vm)
/opt/docker/etc/nginx/vhost.common.d Vhost configuration directory
(automatically included files)
/opt/docker/etc/nginx/vhost.common.d/ Redirect requests to DOCUMENT_INDEX
10-location-root.conf
/opt/docker/etc/nginx/vhost.common.d/ PHP cgi configuration for vhost
10-php.conf
/opt/docker/etc/nginx/global.conf Global nginx configuration
/opt/docker/etc/nginx/main.conf Main Nginx configuration
/opt/docker/etc/nginx/php.conf Deprecated PHP configuration
/opt/docker/etc/nginx/vhost.common.conf Deprecated vhost common include
/opt/docker/etc/nginx/vhost.conf Vhost configuration
/opt/docker/etc/nginx/vhost.ssl.conf Vhost SSL configuration
/opt/docker/etc/supervisor.d/nginx.conf Supervisord configuration file for Nginx

44 Chapter 2. Docker images


Dockerfile Documentation

PHP layout

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application. Application PHP-FPM pool configuration
conf file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-
FPM

2.12 webdevops/ssh

These image extends webdevops/bootstrap and provides a standalone ssh server running on port 22.

2.12.1 Docker image tags

Tag Distribution name


latest Ubuntu 16.04 xenial (LTS)

2.12.2 Environment variables

Environment variable Description Default


SERVICE_SSH_OPTS SSH command arguments empty

2.13 webdevops/storage

These image extends busybox and provides /storage as volume to other containers.

2.13.1 Docker image tags

Tag Distribution name


latest Busybox

2.14 webdevops/vsftp

These image extends webdevops/base and provides a standalone vsftp server running on port 20 and 21.
Uses Supervisord
This image is using supervisor and runs the daemon under user application (UID 1000; GID 1000) as default. If
the container is started under a different user the daemon will be run under the specified uid.

2.12. webdevops/ssh 45
Dockerfile Documentation

2.14.1 Docker image tags

Tag Distribution name


latest Ubuntu 18.04 xenial (LTS)

2.14.2 Environment variables

Environment variable Description Default


FTP_USER FTP account username application
FTP_PASSWORD FTP account password application
FTP_UID FTP account uid 1000
FTP_GID FTP account gid 1000
FTP_PATH FTP account home path /data/ftp/
SERVICE_VSFTP_OPTS VSFTP command arguments empty

46 Chapter 2. Docker images


CHAPTER 3

Commands (bin/console)

3.1 Requirements

• python and PIP


• ruby for serverspec tests

3.2 Install dependencies

The building process, we need some python packages as well as ruby rspec and serverspec packages:

make requirements

3.3 Configuration

All commands are using configuration options from conf/console.yml.

3.4 bin/console tasks

Tip: Most tasks are using arguments as whitelist addon for easier usage.

3.4.1 bin/console docker:build

Build all Dockerfiles found in docker/ directory. The directory structure defines the naming of the built images
(using convention over configuration).

47
Dockerfile Documentation

Option Description Values


-v Verbose output option only
–threads=n Run in parallized mode (currently multi-process instead numeric values, auto, auto/2, auto*2,
of real threads) auto-2, auto+2
–dry-run Don’t really execute build process option only
–no-cache Don’t use Docker caching option only
–retry=n Retry process multiple times (eg. for networking issues) numeric values
–whitelist=termOnly build Docker images with term in name string value
–black- Don’t build Docker images with term in name string value
list=term

3.4.2 bin/console docker:push

Push (upload) all built Docker images to registry (using convention over configuration).

Option Description Values


-v Verbose output option only
–threads=n Run in parallized mode (currently multi-process instead numeric values, auto, auto/2, auto*2,
of real threads) auto-2, auto+2
–dry-run Don’t really execute build process option only
–retry=n Retry process multiple times (eg. for networking issues) numeric values
–whitelist=termOnly build Docker images with term in name string value
–black- Don’t build Docker images with term in name string value
list=term

3.4.3 bin/console docker:pull

Pull (download) all built Docker images to registry (using convention over configuration).

Option Description Values


-v Verbose output option only
–threads=n Run in parallized mode (currently multi-process instead numeric values, auto, auto/2, auto*2,
of real threads) auto-2, auto+2
–dry-run Don’t really execute build process option only
–retry=n Retry process multiple times (eg. for networking issues) numeric values
–whitelist=termOnly build Docker images with term in name string value
–black- Don’t build Docker images with term in name string value
list=term

3.4.4 bin/console docker:exec

Execute argument as command inside all docker images.


eg. bin/console docker:exec --whitelist php -- 'php -v'
Tip: Separate the docker image command arguments from the console commands with two dashes.

48 Chapter 3. Commands (bin/console)


Dockerfile Documentation

Option Description Values


-v Verbose output option only
–dry-run Don’t really execute build process option only
–whitelist=term Only build Docker images with term in name string value
–blacklist=term Don’t build Docker images with term in name string value

3.4.5 bin/console test:testinfra

Test built images with testinfra (python module), spec files are inside tests/testinfra

Option Description Values


-v Verbose output option only
–threads=n Run in parallized mode (currently multi-process instead numeric values, auto, auto/2, auto*2,
of real threads) auto-2, auto+2
–dry-run Don’t really execute build process option only
–whitelist=termOnly build Docker images with term in name string value
–black- Don’t build Docker images with term in name string value
list=term

3.4.6 bin/console test:serverspec

Test built images with serverspec (python module), spec files are inside tests/serverspec

Option Description Values


–threads=n Run in parallized mode (currently multi-process instead numeric values, auto, auto/2, auto*2,
of real threads) auto-2, auto+2
–dry-run Don’t really execute build process option only
–retry=n Retry process multiple times (eg. for networking issues) numeric values
–whitelist=termOnly build Docker images with term in name string value
–black- Don’t build Docker images with term in name string value
list=term

3.4.7 bin/console generate:graph

Generates Docker images dependency graph using graphviz.

3.4.8 bin/console generate:dockerfile

Generate Dockerfiles from Dockerfile.jinja2 templates.


Configuration is stored inside conf/diagram.yml.

3.4.9 bin/console generate:provision

Generate provision (common configuration files) and deploy them to the specified Dockerfile directories.
Configuration is stored inside conf/provision.yml.

3.4. bin/console tasks 49


Dockerfile Documentation

50 Chapter 3. Commands (bin/console)


CHAPTER 4

Customization

This section is not done yet!

4.1 Docker image tools

4.1.1 docker-service

For enabling or disabling services run docker-service enable or docker-service disable inside your Dockerfile:

RUN docker-service enable ssh

This task will also trigger an auto installation if the daemon is not installed.
Available services are specified inside /opt/docker/etc/supervisor.d/.
Common services are:
• cron
• dnsmasq
• postfix
• ssh
• syslog

4.1.2 docker-cronjob

For adding cronjobs the docker-cronjob script can be used in your Dockerfile:

RUN docker-cronjob '* * * * * application /app/cron.php`

Because this comand is run in shell mode make sure you add appropriate quotes to disable wildcard matching.

51
Dockerfile Documentation

4.1.3 docker-provision

The docker-provision script crontols the ansible provision system. See provision for more details.
(Will be replaced in future)

4.1.4 go-replace

Simple but powerfull search&replace and template processing tool for manipulating files inside Docker:

# normal search&replace
go-replace -s VIRTUAL_HOST -r "$VIRTUAL_HOST" daemon.conf

# or with template
go-replace --mode=template daemon.conf.tmpl:daemon.conf

For more informations see documentation inside go-replace repository.

4.2 Provisioning

Important: Provision system is only available in Docker images which are based on webdevops/base!

4.2.1 Custom entrypoint scripts

Shell scripts (*.sh) for container startup can be placed inside following directories:
• /entrypoint.d/
• /opt/docker/provision/entrypoint.d/
These files (*.sh) will be executed automatically.

4.2.2 Provision Events

Provision event/tag Description


bootstrap Run on Docker image creation (only run once)
build Run on Docker image build
onbuild Run on Docker image ONBUILD
entrypoint Run on Docker image entrypoint execution (only here Environment variables are available)

Attention: Try to avoid entrypoint provision tasks because it delays startup time.

4.2.3 Shell script provision

For each provision event there is a directory for shell scripts:


• /opt/docker/provision/bootstrap.d/

52 Chapter 4. Customization
Dockerfile Documentation

• /opt/docker/provision/build.d/
• /opt/docker/provision/onbuild.d/
• /opt/docker/provision/entrypoint.d/
For customization just add your shell scripts into these directories for the simple shell script provision system.

4.2.4 Ansible provision

For Ansible the provision events are available as tags. The roles are located inside /opt/docker/provision/
roles/ and must be registred with the provision system:
/opt/docker/bin/provision add --tag bootstrap --role my-own-role

Multiple tags can be defined with multiple --tag options:


/opt/docker/bin/provision add --tag bootstrap --tag build --role my-own-role

There is a pritory system for roles in which order they should be executed, default priority is 100:
## run before
/opt/docker/bin/provision add --tag bootstrap --priority 40 --role my-own-role-first

## run with normal priority


/opt/docker/bin/provision add --tag bootstrap --role my-own-role

## run after
/opt/docker/bin/provision add --tag bootstrap --priority 200 --role my-own-role-last

It’s also possible to run one role with the provision command:
/opt/docker/bin/provision run --tag bootstrap --role my-own-role

4.3 Supervisor Daemon (Services)

Important: Supervisor is only available in Docker images which are based on webdevops/base!

4.3.1 Introduction

Supervisor daemon is used to start and supervise more than one process in Docker containers. More about supervisor
can be found on supervisor homepage at http://supervisord.org/

4.3.2 Enable and disable services

For enabling services run docker-service-enable or docker-service-disable inside your Dockerfile.


eg:
RUN docker-service-enable ssh

This task will also trigger an auto installation if the daemon is not installed.

4.3. Supervisor Daemon (Services) 53


Dockerfile Documentation

4.3.3 Configuration

The main supervisor configuration file is located at /opt/docker/etc/supervisor.conf and only controls
the supervisor daemon itself. All services are configured inside /opt/docker/etc/supervisor.d/ directory.
Example configuration for hhvm:

[group:hhvm]
programs=hhvmd
priority=20

[program:hhvmd]
command = /opt/docker/bin/service.d/hhvm.sh
process_name=%(program_name)s
directory = /var/run/hhvm/
startsecs = 0
autostart = true
autorestart = true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

4.3.4 Service daemon scripts

For every service there is a small bash script inside /opt/docker/bin/service.d/ which takes care how to
start the service. This script also have a modular task runner which runs files from /opt/docker/bin/service.
d/SERVICE.d/*.sh.
Example for HHVM:
HHVM’s service script is located at /opt/docker/bin/service.d/hhvm.sh.
Before running HHVM all scripts found with /opt/docker/bin/service.d/hhvm.d/*.sh will
be executed.

54 Chapter 4. Customization
CHAPTER 5

Known issues

5.1 General images

5.1.1 webdevops/. . . :alpine-3

• doesn’t support locales (upstream issue)

5.2 PHP images

5.2.1 webdevops/php. . . :ubuntu-12.04

• missing redis
• missing apcu

5.2.2 webdevops/php. . . :debian-7

• missing redis
• missing apcu

5.2.3 webdevops/php. . . :alpine-3

• missing mhash

5.2.4 webdevops/php. . . -dev:alpine-3

• missing blackfire (not supported)

55
Dockerfile Documentation

5.2.5 webdevops/php. . . -dev:debian-8-php7

• missing xdebug

56 Chapter 5. Known issues


CHAPTER 6

FAQ

Placeholder

57

You might also like