SlideShare a Scribd company logo
GETTING INSTANTLY UP AND RUNNING

WITH DOCKER AND SYMFONY
GETTING STARTED AND BEYOND WITH DOCKER AND SYMFONY
André Rømcke - VP Engineering @ezsystems
Symfony Live London, 16th of September 2016
www.ez.no
Warning
๏Won’t cover performance issues on Win/Mac in dev mode due to very slow FS
๏Pragmatic “fix” is to use Linux, or VM with files shared to host over nfs
๏Besides that there are third party solutions with own pitfalls, eg docker-sync
๏This is the first time I do this talk, so hold on tight
๏Including demo effect ;)
www.ez.no
Who?
๏André Rømcke | @andrerom
๏Norwegian, like being social, mountains, skiing, biking, running, technology
๏PHP for 11 years. From 96: Html, CSS, JS, VB, C#, PHP, Bash, Groovy, (Hack)
๏Contributed to Symfony, FOS, Composer, FIG, Docker, and attempting for PHP
๏VP Engineering at eZ Systems
๏eZ Systems AS | ez.no
๏Global, 70 people across 7 countries, partners & community in many many more
๏Maker of eZ Publish since 2001, 6th+ gen called eZ Studio (commercial) & eZ Platform
๏eZ Platform | ezplatform.com
๏Open source Content Management System, a super flexible Full and Headless CMS
๏Developed since 2011, on Symfony Full Stack since 2012 (v2.0)
www.ez.no
Getting started
basic example
The instant part, what we’ll cover:
1.Clone Symfony standard
2.Add Dockerfile for building our application container
3.Add docker-compose.yml to define our software services
4.[Optional] Add .dockerignore file to hint which files should be ignored
5.[Optional] Add .env variable for default variables
www.ez.nowww.ez.no
Getting started: #1 Clone Symfony standard
$ git clone https://github.com/symfony/symfony-standard.git
$ cd symfony-standard
# Or using composer	create-project, or using Symfony installer, ..
www.ez.nowww.ez.no
Getting started: #2 Add basic Dockerfile
$ vim Dockerfile
FROM php:7.0-apache

MAINTAINER André Rømcke "ar@ez.no"

ENV COMPOSER_HOME=/root/.composer SYMFONY_ENV=prod



COPY . /var/www/html



# … (install Composer, or skip the composer instal step below)



RUN composer install -o -n --no-progress --prefer-dist 

&& echo "Clear cache and logs so container starts clean" 

&& rm -Rf var/logs/* var/cache/*/* 

&& echo "Set perm for www-data, add data folder if you have" 

&& chown -R www-data:www-data var/cache var/logs var/sessions





EXPOSE 80

CMD ["apache2-foreground"]
www.ez.nowww.ez.no
Getting started: #3 Add basic docker-compose.yml
$ vim docker-compose.yml
version: '2'



services:

web:

build: .

image: my_web

ports: [ "8088:80" ]

environment:

- SYMFONY_ENV

- SYMFONY_DEBUG
www.ez.nowww.ez.no
Getting started: #4 Add basic .dockerignore
$ vim .dockerignore
# GIT files

.git/
# Cache, session files and logs (Symfony3)

var/cache/*

var/logs/*

var/sessions/*

!var/cache/.gitkeep

!var/logs/.gitkeep

!var/sessions/.gitkeep
www.ez.nowww.ez.no
Getting started: #5 Add default .env variables
Or having to hard code and duplicate defaults in your docker-compose.yml:
environment:

- SYMFONY_ENV=prod

- SYMFONY_DEBUG=0
Instead of having to always specify ENV variables on command line:
export SYMFONY_ENV=prod SYMFONY_DEBUG=0



docker-compose up -d
www.ez.nowww.ez.no
Getting started: #5 Add default .env variables
Instead we can set all default in one file:

$ vim .env
# Default env variables, see: https://docs.docker.com/compose/env-file/

#COMPOSE_FILE=docker-compose.yml



SYMFONY_ENV=prod

SYMFONY_DEBUG=0
Demo time
Up and running
git clone https://github.com/andrerom/symfony-live-london-2016-docker-demo.git sf_demo
cd sf_demo
git show

docker up -d
Conventions in official docker images
order in docker, in official images, and in php image
As the getting started example is way to simple, lets go over some things to know before we
make a more advance example.
We’ll cover:
1.Entrypoints
2.Data dirs
3.EVN variables & Symfony
4.Image Layers (and how it affects image size)
www.ez.nowww.ez.no
Convention: Entrypoint
Found in for instance official mysql/mariadb, postgres, solr images:
# https://github.com/docker-library/mariadb/blob/master/10.1/docker-entrypoint.sh
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sh) echo "$0: running $f"; . "$f" ;;
*.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;;
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
*) echo "$0: ignoring $f" ;;
esac
echo
done
This lets you to pass in sql and/or shell scripts to enhance a
official image without having to extend it with own docker image:
db:

image: ${MYSQL_IMAGE}

volumes_from:

- db_vol:ro
www.ez.nowww.ez.no
Convention: Data dir
Found in for instance mysql/mariadb, postgres, elastic:
Same benefit as entrypoint usage with sql files, but more specifically
for mounting backup data for start up when starting a new environment.
VOLUME /var/lib/mysql
VOLUME /usr/share/elasticsearch/data
VOLUME /var/lib/postgresql/data
www.ez.nowww.ez.no
Convention: ENV variables with Symfony
As “SYMFONY__” ENV variables are broken, common solution is:
env/docker.php
imports:

- { resource: default_parameters.yml }

- { resource: parameters.yml }

- { resource: security.yml }

- { resource: env/docker.php}
<?php

// Executed on symfony container compilation





if ($value = getenv('SYMFONY_SECRET')) {

$container->setParameter('secret', $value);

}
www.ez.nowww.ez.no
Convention: ENV variables with Symfony
But this is hopefully not needed anymore, as of 3.2 we will have this:
www.ez.nowww.ez.no
Convention: Image Layers & image size
• Each instruction in Dockerfile will by default create a new layer
• Which means files added in one layer continues taking space in final image
• Which means you will have to do things like:
# Install and configure php plugins

RUN set -xe 

&& buildDeps=" 

$PHP_EXTRA_BUILD_DEPS 

libfreetype6-dev 

libjpeg62-turbo-dev libxpm-dev libpng12-dev libicu-dev libxslt1-dev 

&& apt-get update && apt-get install -y --force-yes $buildDeps --no-install-
recommends && rm -rf /var/lib/apt/lists/* 

# Extract php source and install missing extensions

&& docker-php-source extract 

&& (…)

# Delete source & builds deps so it does not hang around in layers taking up space

&& docker-php-source delete 

&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
$buildDeps
Advance use
extending, composing and using
Lets have a look at some actual code.
Sources:
- https://github.com/ezsystems/docker-php/blob/master/php/Dockerfile-7.0#L33
- https://github.com/ezsystems/ezplatform/tree/master/doc/docker-compose
Fin
the end, but hopefully just the beginning
For more on eZ Platform see ezplatform.com

More Related Content

PPTX
Dockerizing a Symfony2 application
PPTX
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
PDF
Dockerize your Symfony application - Symfony Live NYC 2014
PDF
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
PPTX
Deploying Symfony2 app with Ansible
PDF
Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Dock...
PDF
Docker orchestration using core os and ansible - Ansible IL 2015
PDF
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Dockerizing a Symfony2 application
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Deploying Symfony2 app with Ansible
Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Dock...
Docker orchestration using core os and ansible - Ansible IL 2015
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)

What's hot (20)

PDF
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
PDF
Docker perl build
PDF
Docker up and running
PDF
Using Capifony for Symfony apps deployment (updated)
PPT
Learn basic ansible using docker
PPTX
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PDF
Infrastructure Deployment with Docker & Ansible
PPT
Build service with_docker_in_90mins
PDF
Web scale infrastructures with kubernetes and flannel
PDF
Develop QNAP NAS App by Docker
PPTX
6 Million Ways To Log In Docker - NYC Docker Meetup 12/17/2014
PDF
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
PDF
Docker 原理與實作
PPTX
Logging & Metrics with Docker
PPTX
Lessons from running potentially malicious code inside containers
PPTX
Lessons from running potentially malicious code inside Docker containers
PPTX
Dockerizing WordPress
PDF
CoreOS : 설치부터 컨테이너 배포까지
PPTX
Installing and running Postfix within a docker container from the command line
PDF
CoreOSによるDockerコンテナのクラスタリング
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Docker perl build
Docker up and running
Using Capifony for Symfony apps deployment (updated)
Learn basic ansible using docker
PHP on Heroku: Deploying and Scaling Apps in the Cloud
Infrastructure Deployment with Docker & Ansible
Build service with_docker_in_90mins
Web scale infrastructures with kubernetes and flannel
Develop QNAP NAS App by Docker
6 Million Ways To Log In Docker - NYC Docker Meetup 12/17/2014
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
Docker 原理與實作
Logging & Metrics with Docker
Lessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside Docker containers
Dockerizing WordPress
CoreOS : 설치부터 컨테이너 배포까지
Installing and running Postfix within a docker container from the command line
CoreOSによるDockerコンテナのクラスタリング
Ad

Viewers also liked (20)

PDF
PHP Benelux 2017 - Caching The Right Way
PPTX
A Functional Guide to Cat Herding with PHP Generators
PDF
Create, test, secure, repeat
PDF
Amp your site an intro to accelerated mobile pages
PDF
php[world] 2015 Training - Laravel from the Ground Up
PDF
Hack the Future
PDF
Zend Framework Foundations
PPTX
Engineer - Mastering the Art of Software
PDF
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
PDF
Console Apps: php artisan forthe:win
PDF
Git Empowered
PDF
Dip Your Toes in the Sea of Security
PDF
Code Coverage for Total Security in Application Migrations
PDF
Presentation Bulgaria PHP
PPTX
Php extensions
PDF
Conscious Coupling
PDF
SunshinePHP 2017 - Making the most out of MySQL
PPTX
Modern sql
PDF
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
PDF
Intermediate OOP in PHP
PHP Benelux 2017 - Caching The Right Way
A Functional Guide to Cat Herding with PHP Generators
Create, test, secure, repeat
Amp your site an intro to accelerated mobile pages
php[world] 2015 Training - Laravel from the Ground Up
Hack the Future
Zend Framework Foundations
Engineer - Mastering the Art of Software
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
Console Apps: php artisan forthe:win
Git Empowered
Dip Your Toes in the Sea of Security
Code Coverage for Total Security in Application Migrations
Presentation Bulgaria PHP
Php extensions
Conscious Coupling
SunshinePHP 2017 - Making the most out of MySQL
Modern sql
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
Intermediate OOP in PHP
Ad

Similar to Getting instantly up and running with Docker and Symfony (20)

PDF
Agile Brown Bag - Vagrant & Docker: Introduction
PPTX
Deploying Windows Containers on Windows Server 2016
PPTX
Docker Security workshop slides
PDF
Drone CI/CD 自動化測試及部署
PPT
Python Deployment with Fabric
PPTX
Introduction to docker
PDF
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
PDF
Symfony finally swiped right on envvars
PPTX
[Codelab 2017] Docker 기초 및 활용 방안
PDF
How to create your own hack environment
PPTX
Docker for Web Developers: A Sneak Peek
PPTX
Real World Experience of Running Docker in Development and Production
PPTX
Docker 101
PPTX
Running Docker in Development & Production (#ndcoslo 2015)
PDF
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
PPTX
A Fabric/Puppet Build/Deploy System
PDF
Docker, c'est bonheur !
PDF
Dependencies Managers in C/C++. Using stdcpp 2014
PDF
Be a happier developer with Docker: Tricks of the trade
PPTX
Pluralsight Webinar: Simplify Your Project Builds with Docker
Agile Brown Bag - Vagrant & Docker: Introduction
Deploying Windows Containers on Windows Server 2016
Docker Security workshop slides
Drone CI/CD 自動化測試及部署
Python Deployment with Fabric
Introduction to docker
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
Symfony finally swiped right on envvars
[Codelab 2017] Docker 기초 및 활용 방안
How to create your own hack environment
Docker for Web Developers: A Sneak Peek
Real World Experience of Running Docker in Development and Production
Docker 101
Running Docker in Development & Production (#ndcoslo 2015)
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
A Fabric/Puppet Build/Deploy System
Docker, c'est bonheur !
Dependencies Managers in C/C++. Using stdcpp 2014
Be a happier developer with Docker: Tricks of the trade
Pluralsight Webinar: Simplify Your Project Builds with Docker

More from André Rømcke (7)

PDF
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
PDF
SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
PDF
Symfony live London 2018 - Take your http caching to the next level with xke...
PDF
Look Towards 2.0 and Beyond - eZ Conference 2016
PDF
PhpTour Lyon 2014 - Transparent caching & context aware http cache
KEY
eZ publish 5[-alpha1] Introduction & Architecture
KEY
eZ Publish 5, Re architecture, pitfalls and opportunities
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
Symfony live London 2018 - Take your http caching to the next level with xke...
Look Towards 2.0 and Beyond - eZ Conference 2016
PhpTour Lyon 2014 - Transparent caching & context aware http cache
eZ publish 5[-alpha1] Introduction & Architecture
eZ Publish 5, Re architecture, pitfalls and opportunities

Recently uploaded (20)

PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Nekopoi APK 2025 free lastest update
PPTX
Transform Your Business with a Software ERP System
PDF
AI in Product Development-omnex systems
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPT
Introduction Database Management System for Course Database
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
ai tools demonstartion for schools and inter college
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Digital Strategies for Manufacturing Companies
PPTX
Online Work Permit System for Fast Permit Processing
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PTS Company Brochure 2025 (1).pdf.......
Nekopoi APK 2025 free lastest update
Transform Your Business with a Software ERP System
AI in Product Development-omnex systems
Understanding Forklifts - TECH EHS Solution
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Softaken Excel to vCard Converter Software.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Introduction Database Management System for Course Database
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
ai tools demonstartion for schools and inter college
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Design an Analysis of Algorithms I-SECS-1021-03
medical staffing services at VALiNTRY
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Digital Strategies for Manufacturing Companies
Online Work Permit System for Fast Permit Processing

Getting instantly up and running with Docker and Symfony

  • 1. GETTING INSTANTLY UP AND RUNNING
 WITH DOCKER AND SYMFONY GETTING STARTED AND BEYOND WITH DOCKER AND SYMFONY André Rømcke - VP Engineering @ezsystems Symfony Live London, 16th of September 2016
  • 2. www.ez.no Warning ๏Won’t cover performance issues on Win/Mac in dev mode due to very slow FS ๏Pragmatic “fix” is to use Linux, or VM with files shared to host over nfs ๏Besides that there are third party solutions with own pitfalls, eg docker-sync ๏This is the first time I do this talk, so hold on tight ๏Including demo effect ;)
  • 3. www.ez.no Who? ๏André Rømcke | @andrerom ๏Norwegian, like being social, mountains, skiing, biking, running, technology ๏PHP for 11 years. From 96: Html, CSS, JS, VB, C#, PHP, Bash, Groovy, (Hack) ๏Contributed to Symfony, FOS, Composer, FIG, Docker, and attempting for PHP ๏VP Engineering at eZ Systems ๏eZ Systems AS | ez.no ๏Global, 70 people across 7 countries, partners & community in many many more ๏Maker of eZ Publish since 2001, 6th+ gen called eZ Studio (commercial) & eZ Platform ๏eZ Platform | ezplatform.com ๏Open source Content Management System, a super flexible Full and Headless CMS ๏Developed since 2011, on Symfony Full Stack since 2012 (v2.0)
  • 4. www.ez.no Getting started basic example The instant part, what we’ll cover: 1.Clone Symfony standard 2.Add Dockerfile for building our application container 3.Add docker-compose.yml to define our software services 4.[Optional] Add .dockerignore file to hint which files should be ignored 5.[Optional] Add .env variable for default variables
  • 5. www.ez.nowww.ez.no Getting started: #1 Clone Symfony standard $ git clone https://github.com/symfony/symfony-standard.git $ cd symfony-standard # Or using composer create-project, or using Symfony installer, ..
  • 6. www.ez.nowww.ez.no Getting started: #2 Add basic Dockerfile $ vim Dockerfile FROM php:7.0-apache
 MAINTAINER André Rømcke "ar@ez.no"
 ENV COMPOSER_HOME=/root/.composer SYMFONY_ENV=prod
 
 COPY . /var/www/html
 
 # … (install Composer, or skip the composer instal step below)
 
 RUN composer install -o -n --no-progress --prefer-dist 
 && echo "Clear cache and logs so container starts clean" 
 && rm -Rf var/logs/* var/cache/*/* 
 && echo "Set perm for www-data, add data folder if you have" 
 && chown -R www-data:www-data var/cache var/logs var/sessions
 
 
 EXPOSE 80
 CMD ["apache2-foreground"]
  • 7. www.ez.nowww.ez.no Getting started: #3 Add basic docker-compose.yml $ vim docker-compose.yml version: '2'
 
 services:
 web:
 build: .
 image: my_web
 ports: [ "8088:80" ]
 environment:
 - SYMFONY_ENV
 - SYMFONY_DEBUG
  • 8. www.ez.nowww.ez.no Getting started: #4 Add basic .dockerignore $ vim .dockerignore # GIT files
 .git/ # Cache, session files and logs (Symfony3)
 var/cache/*
 var/logs/*
 var/sessions/*
 !var/cache/.gitkeep
 !var/logs/.gitkeep
 !var/sessions/.gitkeep
  • 9. www.ez.nowww.ez.no Getting started: #5 Add default .env variables Or having to hard code and duplicate defaults in your docker-compose.yml: environment:
 - SYMFONY_ENV=prod
 - SYMFONY_DEBUG=0 Instead of having to always specify ENV variables on command line: export SYMFONY_ENV=prod SYMFONY_DEBUG=0
 
 docker-compose up -d
  • 10. www.ez.nowww.ez.no Getting started: #5 Add default .env variables Instead we can set all default in one file:
 $ vim .env # Default env variables, see: https://docs.docker.com/compose/env-file/
 #COMPOSE_FILE=docker-compose.yml
 
 SYMFONY_ENV=prod
 SYMFONY_DEBUG=0
  • 11. Demo time Up and running git clone https://github.com/andrerom/symfony-live-london-2016-docker-demo.git sf_demo cd sf_demo git show
 docker up -d
  • 12. Conventions in official docker images order in docker, in official images, and in php image As the getting started example is way to simple, lets go over some things to know before we make a more advance example. We’ll cover: 1.Entrypoints 2.Data dirs 3.EVN variables & Symfony 4.Image Layers (and how it affects image size)
  • 13. www.ez.nowww.ez.no Convention: Entrypoint Found in for instance official mysql/mariadb, postgres, solr images: # https://github.com/docker-library/mariadb/blob/master/10.1/docker-entrypoint.sh for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; *) echo "$0: ignoring $f" ;; esac echo done This lets you to pass in sql and/or shell scripts to enhance a official image without having to extend it with own docker image: db:
 image: ${MYSQL_IMAGE}
 volumes_from:
 - db_vol:ro
  • 14. www.ez.nowww.ez.no Convention: Data dir Found in for instance mysql/mariadb, postgres, elastic: Same benefit as entrypoint usage with sql files, but more specifically for mounting backup data for start up when starting a new environment. VOLUME /var/lib/mysql VOLUME /usr/share/elasticsearch/data VOLUME /var/lib/postgresql/data
  • 15. www.ez.nowww.ez.no Convention: ENV variables with Symfony As “SYMFONY__” ENV variables are broken, common solution is: env/docker.php imports:
 - { resource: default_parameters.yml }
 - { resource: parameters.yml }
 - { resource: security.yml }
 - { resource: env/docker.php} <?php
 // Executed on symfony container compilation
 
 
 if ($value = getenv('SYMFONY_SECRET')) {
 $container->setParameter('secret', $value);
 }
  • 16. www.ez.nowww.ez.no Convention: ENV variables with Symfony But this is hopefully not needed anymore, as of 3.2 we will have this:
  • 17. www.ez.nowww.ez.no Convention: Image Layers & image size • Each instruction in Dockerfile will by default create a new layer • Which means files added in one layer continues taking space in final image • Which means you will have to do things like: # Install and configure php plugins
 RUN set -xe 
 && buildDeps=" 
 $PHP_EXTRA_BUILD_DEPS 
 libfreetype6-dev 
 libjpeg62-turbo-dev libxpm-dev libpng12-dev libicu-dev libxslt1-dev 
 && apt-get update && apt-get install -y --force-yes $buildDeps --no-install- recommends && rm -rf /var/lib/apt/lists/* 
 # Extract php source and install missing extensions
 && docker-php-source extract 
 && (…)
 # Delete source & builds deps so it does not hang around in layers taking up space
 && docker-php-source delete 
 && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps
  • 18. Advance use extending, composing and using Lets have a look at some actual code. Sources: - https://github.com/ezsystems/docker-php/blob/master/php/Dockerfile-7.0#L33 - https://github.com/ezsystems/ezplatform/tree/master/doc/docker-compose
  • 19. Fin the end, but hopefully just the beginning For more on eZ Platform see ezplatform.com