Dockerfile Readthedocs Io en Latest
Dockerfile Readthedocs Io en Latest
Florian Tatzel
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
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
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
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.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.
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.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"]
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.
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
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.
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.
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. webdevops/php 15
Dockerfile Documentation
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.
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.
Composer
Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.
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
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.
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. webdevops/php-apache 19
Dockerfile Documentation
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.
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.
Composer
Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.
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
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.
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
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.
2.8. webdevops/php-apache-dev 23
Dockerfile Documentation
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.
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.
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.
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.
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
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.
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
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
Attention: PHP is running in development mode. Zend Opcode Cache is set to to revalidate files for best
development experience.
2.9. webdevops/php-dev 29
Dockerfile Documentation
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.
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.
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.
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.
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
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. webdevops/php-nginx 35
Dockerfile Documentation
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.
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.
Composer
Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between com-
poser versions.
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
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.
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
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.
2.11. webdevops/php-nginx-dev 39
Dockerfile Documentation
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.
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.
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
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.
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
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.
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
2.12 webdevops/ssh
These image extends webdevops/bootstrap and provides a standalone ssh server running on port 22.
2.13 webdevops/storage
These image extends busybox and provides /storage as volume to other containers.
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
Commands (bin/console)
3.1 Requirements
The building process, we need some python packages as well as ruby rspec and serverspec packages:
make requirements
3.3 Configuration
Tip: Most tasks are using arguments as whitelist addon for easier usage.
Build all Dockerfiles found in docker/ directory. The directory structure defines the naming of the built images
(using convention over configuration).
47
Dockerfile Documentation
Push (upload) all built Docker images to registry (using convention over configuration).
Pull (download) all built Docker images to registry (using convention over configuration).
Test built images with testinfra (python module), spec files are inside tests/testinfra
Test built images with serverspec (python module), spec files are inside tests/serverspec
Generate provision (common configuration files) and deploy them to the specified Dockerfile directories.
Configuration is stored inside conf/provision.yml.
Customization
4.1.1 docker-service
For enabling or disabling services run docker-service enable or docker-service disable inside your Dockerfile:
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:
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
4.2 Provisioning
Important: Provision system is only available in Docker images which are based on webdevops/base!
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.
Attention: Try to avoid entrypoint provision tasks because it delays startup time.
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.
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
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 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
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/
This task will also trigger an auto installation if the daemon is not installed.
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
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
• missing redis
• missing apcu
• missing redis
• missing apcu
• missing mhash
55
Dockerfile Documentation
• missing xdebug
FAQ
Placeholder
57