Overview

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.


Introduction

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/.

Docker images

_images/docker-image-layout.gv.png

Docker image hierarchy

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.

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  

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 arguments empty (when php fpm is used)
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE Nginx client_max_body_size 50m (when nginx is used)

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 configuration 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.

Docker image layout

Apache layout
File/Directory Description
/opt/docker/etc/httpd/conf.d badge-customization

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/10-error-document.conf Error document configuration
/opt/docker/etc/httpd/conf.d/10-log.conf Log configuration
/opt/docker/etc/httpd/conf.d/10-server.conf Basic server configuration
/opt/docker/etc/httpd/ssl badge-customization

SSL configuration directory for

certifications and keys

/opt/docker/etc/httpd/ssl/server.crt badge-customization Example SSL certification (*.vm)
/opt/docker/etc/httpd/ssl/server.csr badge-customization Example SSL certification request (*.vm)
/opt/docker/etc/httpd/ssl/server.key badge-customization Example SSL key (*.vm)
/opt/docker/etc/httpd/vhost.common.d badge-customization

Vhost configuration directory

(automatically included files)

/opt/docker/etc/httpd/vhost.common.d/01-boilerplate.conf

Placeholder configuration file

(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 badge-deprecated Deprecated PHP configuration
/opt/docker/etc/httpd/vhost.common.conf badge-deprecated 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

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.

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  

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)

Entrypoint

The entrypoint script is located in /opt/docker/bin/entrypoint.sh and will also start the entrypoint provisioning 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"]
File/Directory Description
/opt/docker/bin/entrypoint.sh Entrypoint script for ENTRYPOINT instruction in Dockerfile
/opt/docker/bin/entrypoint.d/default.sh Default worker script, will execute the defined cmd
/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/supervisord.sh Starts supervisord daemon at startup (CMD ["supervisord"])

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.conf Main supervisord configuration file
/opt/docker/etc/supervisor.d/*.conf Modular service configuration files for supervisord (will be included automatically)
/opt/docker/bin/servide.d/*.sh Service scripts if services needs more than just a single command line for startup

Provisioning

With Ansible the provisioning tasks can be easliy done inside the Docker image (eg. for configurations and deployments). 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)
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/bootstrap.d/*.sh Directory for provisioning shell scripts (tag: bootstrap)
/opt/docker/provision/build.d/*.sh Directory for provisioning shell scripts (tag: build)
/opt/docker/provision/onbuild.d/*.sh Directory for provisioning shell scripts (tag: onbuild)
/opt/docker/provision/entrypoint.d/*.sh Directory for provisioning shell scripts (tag: entrypoint)

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.

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  

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

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.

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  

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)

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.

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  

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 arguments empty (when php fpm is used)
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE Nginx client_max_body_size 50m (when nginx is used)

Customization

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 configuration 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.

Docker image layout

Nginx layout
File/Directory Description
/opt/docker/etc/nginx/conf.d badge-customization

Main global configuration directory

(automatically included files)

/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl badge-customization

SSL configuration directory for

certifications and keys

/opt/docker/etc/nginx/ssl/server.crt badge-customization Example SSL certification (*.vm)
/opt/docker/etc/nginx/ssl/server.csr badge-customization Example SSL certification request (*.vm)
/opt/docker/etc/nginx/ssl/server.key badge-customization Example SSL key (*.vm)
/opt/docker/etc/nginx/vhost.common.d badge-customization

Vhost configuration directory

(automatically included files)

/opt/docker/etc/nginx/vhost.common.d/10-location-root.conf Redirect requests to DOCUMENT_INDEX
/opt/docker/etc/nginx/vhost.common.d/10-php.conf PHP cgi configuration for vhost
/opt/docker/etc/nginx/global.conf Global nginx configuration
/opt/docker/etc/nginx/main.conf Main Nginx configuration
/opt/docker/etc/nginx/php.conf badge-deprecated Deprecated PHP configuration
/opt/docker/etc/nginx/vhost.common.conf badge-deprecated 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

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.

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
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

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.

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.{setting-key} Sets the {setting-key} as fpm global setting for the master process  
fpm.pool.{setting-key} Sets the {setting-key} as fpm pool setting  
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_SERVERS pm.min_spare_servers distribution default
FPM_PM_MAX_SPARE_SERVERS pm.max_spare_servers distribution default
FPM_PROCESS_IDLE_TIMEOUT pm.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 composer 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.

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.

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.

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 badge-customization 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.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

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.

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
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

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
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 arguments empty (when php fpm is used)
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE Nginx client_max_body_size 50m (when nginx is used)
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.

Environment variable Description Default
fpm.global.{setting-key} Sets the {setting-key} as fpm global setting for the master process  
fpm.pool.{setting-key} Sets the {setting-key} as fpm pool setting  
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_SERVERS pm.min_spare_servers distribution default
FPM_PM_MAX_SPARE_SERVERS pm.max_spare_servers distribution default
FPM_PROCESS_IDLE_TIMEOUT pm.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 composer 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.

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.

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 configuration 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.

Docker image layout

Apache layout
File/Directory Description
/opt/docker/etc/httpd/conf.d badge-customization

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/10-error-document.conf Error document configuration
/opt/docker/etc/httpd/conf.d/10-log.conf Log configuration
/opt/docker/etc/httpd/conf.d/10-server.conf Basic server configuration
/opt/docker/etc/httpd/ssl badge-customization

SSL configuration directory for

certifications and keys

/opt/docker/etc/httpd/ssl/server.crt badge-customization Example SSL certification (*.vm)
/opt/docker/etc/httpd/ssl/server.csr badge-customization Example SSL certification request (*.vm)
/opt/docker/etc/httpd/ssl/server.key badge-customization Example SSL key (*.vm)
/opt/docker/etc/httpd/vhost.common.d badge-customization

Vhost configuration directory

(automatically included files)

/opt/docker/etc/httpd/vhost.common.d/01-boilerplate.conf

Placeholder configuration file

(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 badge-deprecated Deprecated PHP configuration
/opt/docker/etc/httpd/vhost.common.conf badge-deprecated 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
PHP layout
File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini badge-customization 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.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

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

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
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

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.

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.{setting-key} Sets the {setting-key} as fpm global setting for the master process  
fpm.pool.{setting-key} Sets the {setting-key} as fpm pool setting  
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_SERVERS pm.min_spare_servers distribution default
FPM_PM_MAX_SPARE_SERVERS pm.max_spare_servers distribution default
FPM_PROCESS_IDLE_TIMEOUT pm.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 composer 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.

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
XDEBUG_START_WITH_REQUEST php.ini value for xdebug.start_with_request none
XDEBUG_REMOTE_AUTOSTART php.ini value for xdebug.remote_autostart none
XDEBUG_REMOTE_CONNECT_BACK php.ini value for xdebug.remote_connect_back none
XDEBUG_DISCOVER_CLIENT_HOST php.ini value for xdebug.discover_client_host none
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
XDEBUG_MAX_NESTING_LEVEL php.ini value for xdebug.max_nesting_level none
XDEBUG_IDE_KEY php.ini value for xdebug.idekey none
XDEBUG_PROFILER_ENABLE php.ini value for xdebug.profiler_enable none
XDEBUG_PROFILER_ENABLE_TRIGGER php.ini value for xdebug.profiler_enable_trigger none
XDEBUG_TRIGGER_VALUE php.ini value for xdebug.trigger_value none
XDEBUG_OUTPUT_DIR php.ini value for xdebug.output_dir none
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE php.ini value for xdebug.profiler_enable_trigger_value none
XDEBUG_PROFILER_OUTPUT_DIR php.ini value for xdebug.profiler_output_dir none
XDEBUG_PROFILER_OUTPUT_NAME php.ini value for xdebug.profiler_output_name none
BLACKFIRE_SERVER_ID php.ini value for blackfire.server_id none
BLACKFIRE_SERVER_TOKEN php.ini value for blackfire.server_token none
SERVICE_BLACKFIRE_AGENT_OPTS Blackfire agent command arguments 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

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.

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 configuration 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.

Docker image layout

Apache layout
File/Directory Description
/opt/docker/etc/httpd/conf.d badge-customization

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/10-error-document.conf Error document configuration
/opt/docker/etc/httpd/conf.d/10-log.conf Log configuration
/opt/docker/etc/httpd/conf.d/10-server.conf Basic server configuration
/opt/docker/etc/httpd/ssl badge-customization

SSL configuration directory for

certifications and keys

/opt/docker/etc/httpd/ssl/server.crt badge-customization Example SSL certification (*.vm)
/opt/docker/etc/httpd/ssl/server.csr badge-customization Example SSL certification request (*.vm)
/opt/docker/etc/httpd/ssl/server.key badge-customization Example SSL key (*.vm)
/opt/docker/etc/httpd/vhost.common.d badge-customization

Vhost configuration directory

(automatically included files)

/opt/docker/etc/httpd/vhost.common.d/01-boilerplate.conf

Placeholder configuration file

(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 badge-deprecated Deprecated PHP configuration
/opt/docker/etc/httpd/vhost.common.conf badge-deprecated 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
PHP layout
File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini badge-customization 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.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

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

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
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

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.

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.{setting-key} Sets the {setting-key} as fpm global setting for the master process  
fpm.pool.{setting-key} Sets the {setting-key} as fpm pool setting  
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_SERVERS pm.min_spare_servers distribution default
FPM_PM_MAX_SPARE_SERVERS pm.max_spare_servers distribution default
FPM_PROCESS_IDLE_TIMEOUT pm.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 composer 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.

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
XDEBUG_START_WITH_REQUEST php.ini value for xdebug.start_with_request none
XDEBUG_REMOTE_AUTOSTART php.ini value for xdebug.remote_autostart none
XDEBUG_REMOTE_CONNECT_BACK php.ini value for xdebug.remote_connect_back none
XDEBUG_DISCOVER_CLIENT_HOST php.ini value for xdebug.discover_client_host none
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
XDEBUG_MAX_NESTING_LEVEL php.ini value for xdebug.max_nesting_level none
XDEBUG_IDE_KEY php.ini value for xdebug.idekey none
XDEBUG_PROFILER_ENABLE php.ini value for xdebug.profiler_enable none
XDEBUG_PROFILER_ENABLE_TRIGGER php.ini value for xdebug.profiler_enable_trigger none
XDEBUG_TRIGGER_VALUE php.ini value for xdebug.trigger_value none
XDEBUG_OUTPUT_DIR php.ini value for xdebug.output_dir none
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE php.ini value for xdebug.profiler_enable_trigger_value none
XDEBUG_PROFILER_OUTPUT_DIR php.ini value for xdebug.profiler_output_dir none
XDEBUG_PROFILER_OUTPUT_NAME php.ini value for xdebug.profiler_output_name none
BLACKFIRE_SERVER_ID php.ini value for blackfire.server_id none
BLACKFIRE_SERVER_TOKEN php.ini value for blackfire.server_token none
SERVICE_BLACKFIRE_AGENT_OPTS Blackfire agent command arguments 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

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.

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.

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 badge-customization 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.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

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.

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
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

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
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 arguments empty (when php fpm is used)
SERVICE_APACHE_OPTS Apache command arguments empty (when apache is used)
SERVICE_NGINX_OPTS Nginx command arguments empty (when nginx is used)
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE Nginx client_max_body_size 50m (when nginx is used)
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.

Environment variable Description Default
fpm.global.{setting-key} Sets the {setting-key} as fpm global setting for the master process  
fpm.pool.{setting-key} Sets the {setting-key} as fpm pool setting  
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_SERVERS pm.min_spare_servers distribution default
FPM_PM_MAX_SPARE_SERVERS pm.max_spare_servers distribution default
FPM_PROCESS_IDLE_TIMEOUT pm.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 composer 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.

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.

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 configuration 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.

Docker image layout

Nginx layout
File/Directory Description
/opt/docker/etc/nginx/conf.d badge-customization

Main global configuration directory

(automatically included files)

/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl badge-customization

SSL configuration directory for

certifications and keys

/opt/docker/etc/nginx/ssl/server.crt badge-customization Example SSL certification (*.vm)
/opt/docker/etc/nginx/ssl/server.csr badge-customization Example SSL certification request (*.vm)
/opt/docker/etc/nginx/ssl/server.key badge-customization Example SSL key (*.vm)
/opt/docker/etc/nginx/vhost.common.d badge-customization

Vhost configuration directory

(automatically included files)

/opt/docker/etc/nginx/vhost.common.d/10-location-root.conf Redirect requests to DOCUMENT_INDEX
/opt/docker/etc/nginx/vhost.common.d/10-php.conf PHP cgi configuration for vhost
/opt/docker/etc/nginx/global.conf Global nginx configuration
/opt/docker/etc/nginx/main.conf Main Nginx configuration
/opt/docker/etc/nginx/php.conf badge-deprecated Deprecated PHP configuration
/opt/docker/etc/nginx/vhost.common.conf badge-deprecated 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 badge-customization 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.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

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

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
centos-7 deprecated PHP 5.4
centos-7-php56 deprecated PHP 5.6
centos-7-php7 deprecated PHP 7.0

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.

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.{setting-key} Sets the {setting-key} as fpm global setting for the master process  
fpm.pool.{setting-key} Sets the {setting-key} as fpm pool setting  
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_SERVERS pm.min_spare_servers distribution default
FPM_PM_MAX_SPARE_SERVERS pm.max_spare_servers distribution default
FPM_PROCESS_IDLE_TIMEOUT pm.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 composer 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.

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
XDEBUG_START_WITH_REQUEST php.ini value for xdebug.start_with_request none
XDEBUG_REMOTE_AUTOSTART php.ini value for xdebug.remote_autostart none
XDEBUG_REMOTE_CONNECT_BACK php.ini value for xdebug.remote_connect_back none
XDEBUG_DISCOVER_CLIENT_HOST php.ini value for xdebug.discover_client_host none
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
XDEBUG_MAX_NESTING_LEVEL php.ini value for xdebug.max_nesting_level none
XDEBUG_IDE_KEY php.ini value for xdebug.idekey none
XDEBUG_PROFILER_ENABLE php.ini value for xdebug.profiler_enable none
XDEBUG_PROFILER_ENABLE_TRIGGER php.ini value for xdebug.profiler_enable_trigger none
XDEBUG_TRIGGER_VALUE php.ini value for xdebug.trigger_value none
XDEBUG_OUTPUT_DIR php.ini value for xdebug.output_dir none
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE php.ini value for xdebug.profiler_enable_trigger_value none
XDEBUG_PROFILER_OUTPUT_DIR php.ini value for xdebug.profiler_output_dir none
XDEBUG_PROFILER_OUTPUT_NAME php.ini value for xdebug.profiler_output_name none
BLACKFIRE_SERVER_ID php.ini value for blackfire.server_id none
BLACKFIRE_SERVER_TOKEN php.ini value for blackfire.server_token none
SERVICE_BLACKFIRE_AGENT_OPTS Blackfire agent command arguments 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

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.

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 configuration 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.

Docker image layout

Nginx layout
File/Directory Description
/opt/docker/etc/nginx/conf.d badge-customization

Main global configuration directory

(automatically included files)

/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl badge-customization

SSL configuration directory for

certifications and keys

/opt/docker/etc/nginx/ssl/server.crt badge-customization Example SSL certification (*.vm)
/opt/docker/etc/nginx/ssl/server.csr badge-customization Example SSL certification request (*.vm)
/opt/docker/etc/nginx/ssl/server.key badge-customization Example SSL key (*.vm)
/opt/docker/etc/nginx/vhost.common.d badge-customization

Vhost configuration directory

(automatically included files)

/opt/docker/etc/nginx/vhost.common.d/10-location-root.conf Redirect requests to DOCUMENT_INDEX
/opt/docker/etc/nginx/vhost.common.d/10-php.conf PHP cgi configuration for vhost
/opt/docker/etc/nginx/global.conf Global nginx configuration
/opt/docker/etc/nginx/main.conf Main Nginx configuration
/opt/docker/etc/nginx/php.conf badge-deprecated Deprecated PHP configuration
/opt/docker/etc/nginx/vhost.common.conf badge-deprecated 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 badge-customization 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.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

webdevops/ssh

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

Docker image tags

Tag Distribution name
latest Ubuntu 16.04 xenial (LTS)

Environment variables

Environment variable Description Default
SERVICE_SSH_OPTS SSH command arguments empty

webdevops/storage

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

Docker image tags

Tag Distribution name
latest Busybox

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.

Docker image tags

Tag Distribution name
latest Ubuntu 18.04 xenial (LTS)

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

Commands (bin/console)

Requirements

  • python and PIP
  • ruby for serverspec tests

Install dependencies

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

make requirements

Configuration

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

bin/console tasks

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

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).

Option Description Values
-v Verbose output option only
–threads=n Run in parallized mode (currently multi-process instead of real threads) numeric values, auto, auto/2, auto*2, 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=term Only build Docker images with term in name string value
–blacklist=term Don’t build Docker images with term in name string value

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 of real threads) numeric values, auto, auto/2, auto*2, 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=term Only build Docker images with term in name string value
–blacklist=term Don’t build Docker images with term in name string value

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 of real threads) numeric values, auto, auto/2, auto*2, 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=term Only build Docker images with term in name string value
–blacklist=term Don’t build Docker images with term in name string value

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.

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

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 of real threads) numeric values, auto, auto/2, auto*2, auto-2, auto+2
–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

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 of real threads) numeric values, auto, auto/2, auto*2, 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=term Only build Docker images with term in name string value
–blacklist=term Don’t build Docker images with term in name string value

bin/console generate:graph

Generates Docker images dependency graph using graphviz.

bin/console generate:dockerfile

Generate Dockerfiles from Dockerfile.jinja2 templates.

Configuration is stored inside conf/diagram.yml.

bin/console generate:provision

Generate provision (common configuration files) and deploy them to the specified Dockerfile directories.

Configuration is stored inside conf/provision.yml.

Customization

This section is not done yet!

Docker image tools

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

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.

docker-provision

The docker-provision script crontols the ansible provision system. See provision for more details.

(Will be replaced in future)

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.

Provisioning

Important

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

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.

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.

Shell script provision

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

  • /opt/docker/provision/bootstrap.d/
  • /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.

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

Supervisor Daemon (Services)

Important

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

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/

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.

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

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.

Known issues

General images

webdevops/…:alpine-3

  • doesn’t support locales (upstream issue)

PHP images

webdevops/php…:ubuntu-12.04

  • missing redis
  • missing apcu

webdevops/php…:debian-7

  • missing redis
  • missing apcu

webdevops/php…:alpine-3

  • missing mhash

webdevops/php…-dev:alpine-3

  • missing blackfire (not supported)

webdevops/php…-dev:debian-8-php7

  • missing xdebug

FAQ

Placeholder