SlideShare a Scribd company logo
Dockerize your Symfony application
Docker: What, Why and How with Symfony?
Symfony Live New York, Oct 9-10 2014!
By @andrerom, VP Engineering at eZ Systems AS
Who am I?
André Rømcke:
• Heads Engineering (Dev, QA & Support) at eZ Systems AS
• PHP for 9 years, started with frontend in 96 <blink>#dhtml</blink>
• Currently living in Lyon, France but from ~Oslo, Norway
!
eZ Systems AS:
• Maker of eZ Publish since 2001
• Norwegian based but with offices in 7 countries and hiring
• Professional partners & Community users in all corners of the world
!
eZ Publish
• A Open source Enterprise Content Management System
• Started using Symfony in 2012 (5.0), will complete the migration to
Symfony in 2015 (6.0) with new product name: eZ Platform
What is Docker?
What is Docker?
Environment as Micro services
!
LEGO for developers?
What is Docker?
Currently on docker.com: “Docker - An open platform for
distributed applications for developers and sysadmins.”

!
!
Docker Engine is built on LXC ( cgroups, namespaces,
Apparmor/SELinux, …) and Union file system to provide a
layered container image format that can run on any recent
Linux distro.

!
Docker Hub is a cloud service for sharing container images
and automating workflows, free for public, paid for private.
Concept: Layers
“Docker Engine”
However lets use a more relevant example…
Concept: Layers
PHP-CPHP-FPM ContainerNginx ContainerMySQL Container
PHP Image
Base Image
Nginx ImageMySQL Image
PHP-PHP-FPM Image
PH
Base Image Base Image Bas
m
e
Container layer Container layer
Container layer Conta
yer
Example: $ sudo docker run -d php-fpm:5.6

!
!
!
!
!
!
!
• Starts a php-fpm container based on a php-fpm image tagged “5.6”

• The php-fpm image extends a plain php image, which again extends
a base image like debian/ubuntu/centos

• You can write to file system inside container, but changes in
container is not persisted when replaced with new version of
image unless using volumes
Concept: DockerFile
• Defines a Docker image
• A bit like VagrantFile meets Puppet/Chef/Anisibel, but using shell
!
• $ sudo docker build -t apache .

FROM debian:wheezy
MAINTAINER Some Maintainer "docker-maint@docker"
!
RUN apt-get -y install apache2
!
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
!
EXPOSE 80
!
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
• Just like you are used to with Vagrant or VM’s you can map ports to
keep images generic
!
• $ sudo docker run -d -p 81:80 —name=web-1 php:5.6-apache
Host!
Listen: 80
Concept: Port Mapping
*:80 80
81
82
www-1

:80
www-2

:80
Varnish

:80
Note:
no advantage
having more then
one www instance
other then for cluster
testing on one
node
• Just like you are used to with Vagrant or VM’s you can map ports to
keep images generic
!
• $ sudo docker run -d -p 81:80 —name=web-1 php:5.6-apache
VM!
Listen: 80
8080
localhost:8080
Concept: Port Mapping
80
81
82
www-1

:80
www-2

:80
Varnish

:80
Note:
no advantage
having more then
one www instance
other then for cluster
testing on one
node
• Shares exposed ports and environment variables from one container
to another
!
• $ sudo docker run -d -p 81:80 --link db-1:db (…)
VM!
Listen: 80
Concept: Container Linking
8080
localhost:8080 80
81
82
www-1

:80
www-2

:80
db-1

:3306
Varnish

:80
• Mounts a folder in Host/VM to a container
• Can be read only or read-write
!
• $ sudo docker run -v /vagrant/www:/www:rw —name=sf-vol (…)
VM!
Listen: 80
Concept: Data Volume
8080
localhost:8080
vagrant/files/www
80
81
82
www-1

:80
www-2

:80
db-1

:3306
sf-volrw
Varnish

:80
• Mounts all volumes in one container to others
• Can be read only or read-write
!
• $ sudo docker run -d -p 81:80 --volumes-from sf-vol (…)
VM!
Listen: 80
Concept: Sharing Data Volume
80
81
82
8080
localhost:8080
vagrant/files/www
rw
www-1

:80
www-2

:80
sf-vol
db-1

:3306
Varnish

:80
How does it compare to VM’s?
Virtual Machines vs Docker
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
HyperVisor
Host OS
Server
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
“Docker Engine”
Host OS
Server
How does it compare to VM’s?
Virtual Machines vs Docker
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
HyperVisor
Host OS
Server
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
“Docker Engine”
Host OS
ServerClose
to zero run time
overhead!
How does it compare to VM’s?
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
“Docker Engine”
Host OS
Server
Virtual Machines vs Docker
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
HyperVisor
Host OS
Server
“Machine”
boots in less then
a second
Close
to zero run time
overhead!
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
“Docker Engine”
Host OS
Server
How does it compare to VM’s?
Virtual Machines vs Docker
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
HyperVisor
Host OS
Server Close
to zero run time
overhead!
Shared
“layers” share
memory
“Machine”
boots in less then
a second
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
“Docker Engine”
Host OS
Server
How does it compare to VM’s?
Virtual Machines vs Docker
App A App B
Bin/Libs Bin/Libs
Guest OS Guest OS
HyperVisor
Host OS
Server Close
to zero run time
overhead!
Image
size advantage; i.e. OS
image only downloaded
once
Shared
“layers” share
memory
“Machine”
boots in less then
a second
Why use Docker?
Why?
Docker holds the promise of:

• Stable official containers for everything* you need on Docker Hub
• No need to care about OS/Linux-distro differences anymore
• Develop once, use and deploy everywhere
• Less need for using abstracted install recipes using Puppet/Chef/
Ansible**
• Can replace capistrano, capifony, ….
!
!
!
!
* Not yet, but getting there. Example: v1 of PHP container out recently
** However they are still very valid for configuration of your app
Example: Not unrealistic that we will have a standard docker config ala fig
which can be used on: Azure, Google Computer, Server, localhost, …
!
How fig.yml currently looks like:
web-1:
image: php:5.6-apache
ports:
- "80:80"
links:
- db-1
volumes:
- /vagrant/volumes/ezpublish:/var/www:rw
db-1:
image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: mysecretpassword
Why?
Check
out Google Kubernetes!

Already supported by Google
and Azure.
Why?
Highly scalable:

• “By forcing you to split out application in micro services it allows you
to scale up part of the application very easily!”



GOTO:
• Google Kubernetes (for use on own, Azure or GoogleCloudPlatform)

• Apache Mesos + Marathon

• …Docker slides from DockerCon for more alternatives…
High level Benefits
Lets Developers iterate on environment like on code:

• Develop & Use locally
• Use for test system keeping test server clean
• Deploy/Deliver to Ops/Sysadmins
• $um: Run everywhere
!
Allows Ops/Sysadmins to standardize around containers:

• Can focus on maintain hosts, scaling, monitoring
• Streamlined Deployments
!
Benefits for your business:

• Standardize environments & deployments across developers, whole
organization and customers
• Opportunity: new marketplace for your application
• Operation Cost
Examples of use and CI/CD
Example: Single app, one node
Server / VM
Varnish www-1
sf-vol
db-vol
php-
fpm-1
db-1
Example of this:
Note for running Symfony-standard on this:
• Rename app.php or app_dev.php to index.php, or change the rewrite rules
• VagrantFile: Comment out d.run command for ezpublish:prepare
• Correct settings in files/vagrant.yml
Example: Single app, Cluster testing on one node
Server / VM
Varnish
www-1
www-2 php-
fpm-2
sf-vol
db-vol
php-
fpm-1
db-1
Example: Single app, several nodes
Web Server / VM 1
www-1
sf-vol
php-
fpm-1
redis-1
load-
balancer
Data-
base
Binary
storage
Web Server / VM 2
www-2
sf-vol
php-
fpm-2
redis-2
Web Server / VM 3 sf-vol
Adding
nodes
on
dem
and
Example: Multiple apps, several nodes “PAAS”
Web Server / VM 1
load-
balancer
Data-
base
Binary
storage
Adding
nodes
on
dem
and
App N
www
sf-vol
php-
fpm
redis
App 3
www
sf-vol
php-
fpm
redis
App 4
www
sf-vol
php-
fpm
redis
App 1
www
sf-vol
php-
fpm
redis
App 2
www
sf-vol
php-
fpm
redis
Web Server / VM 2
App N
www
sf-vol
php-
fpm
redis
App 3
www
sf-vol
php-
fpm
redis
App 4
www
sf-vol
php-
fpm
redis
App 1
www
sf-vol
php-
fpm
redis
App 2
www
sf-vol
php-
fpm
redis
Web Server / VM 3 App 3
www
sf-vol
php- redis
Continues Integration and Deployment?
Docker Hub (Public/Private)All tests
merge publish image
symfony-standard
pull latests stable parent image
Symfony-standard on Docker Hub?
Continues Integration and Deployment?
Own containers (optional) Docker Hub (Public/Private)
merge publish image
Code
Test on stable image
merge deploy updated image
Server / !
Azure /!
Google Cloud /!
…
pull latests stable code
Custom project
Test on stable code
pull latests stable image
Note: Also checkout Pablo Godel’s talk “Rock Solid Deployment of Symfony Apps”
The End
Resources:

• registry.hub.docker.com (Official and community made containers)
• github.com/ezsystems/ezpublish-docker (referred to in slides)
• ez.no/Blog/What-is-Docker-and-why-should-I-care
!
• Running Docker on cluster:
• https://github.com/GoogleCloudPlatform/kubernetes
• mesosphere.com/learn/
• aws.amazon.com/blogs/aws/container-computing/
!
Twitter: @andrerom
Joined.in: https://joind.in/12188
!
PS: eZ launches 100% Symfony CMS in 2015 called eZ Platform
based on todays “New/Symfony stack” in eZ Publish 5.x

More Related Content

What's hot (20)

PPTX
Docker orchestration
Open Source Consulting
 
PDF
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Anthony Chu
 
PDF
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Ruoshi Ling
 
PDF
Developing and Deploying PHP with Docker
Patrick Mizer
 
PPT
Build service with_docker_in_90mins
Larry Cai
 
PDF
Docker orchestration using core os and ansible - Ansible IL 2015
Leonid Mirsky
 
PPTX
Exploring Docker Security
Patrick Kleindienst
 
PDF
Docker 初探,實驗室中的運貨鯨
Ruoshi Ling
 
PPSX
Docker and containers - Presentation Slides by Priyadarshini Anand
PRIYADARSHINI ANAND
 
PPTX
Real World Experience of Running Docker in Development and Production
Ben Hall
 
PPTX
Native Containers on Windows 10 & Windows Server 2016 using Docker
Jorge Arteiro
 
PDF
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
謝 宗穎
 
PDF
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
Docker, Inc.
 
PDF
Docker Distributed application bundle & Stack - Overview
Thomas Chacko
 
PPTX
The How and Why of Windows containers
Ben Hall
 
PPTX
Docker 1.11 Presentation
Sreenivas Makam
 
PPTX
Running Docker in Development & Production (DevSum 2015)
Ben Hall
 
PDF
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
PDF
Docker 原理與實作
kao kuo-tung
 
PDF
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
raccoony
 
Docker orchestration
Open Source Consulting
 
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Anthony Chu
 
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Ruoshi Ling
 
Developing and Deploying PHP with Docker
Patrick Mizer
 
Build service with_docker_in_90mins
Larry Cai
 
Docker orchestration using core os and ansible - Ansible IL 2015
Leonid Mirsky
 
Exploring Docker Security
Patrick Kleindienst
 
Docker 初探,實驗室中的運貨鯨
Ruoshi Ling
 
Docker and containers - Presentation Slides by Priyadarshini Anand
PRIYADARSHINI ANAND
 
Real World Experience of Running Docker in Development and Production
Ben Hall
 
Native Containers on Windows 10 & Windows Server 2016 using Docker
Jorge Arteiro
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
謝 宗穎
 
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
Docker, Inc.
 
Docker Distributed application bundle & Stack - Overview
Thomas Chacko
 
The How and Why of Windows containers
Ben Hall
 
Docker 1.11 Presentation
Sreenivas Makam
 
Running Docker in Development & Production (DevSum 2015)
Ben Hall
 
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
Docker 原理與實作
kao kuo-tung
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
raccoony
 

Similar to Dockerize your Symfony application - Symfony Live NYC 2014 (20)

PPTX
Docker - Demo on PHP Application deployment
Arun prasath
 
PDF
Killer Docker Workflows for Development
Chris Tankersley
 
PDF
Introduction to Docker
Kuan Yen Heng
 
PDF
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
Gaetano Giunta
 
PPTX
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
PPTX
Java developer intro to environment management with vagrant puppet and docker
Getting value from IoT, Integration and Data Analytics
 
PDF
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Partner S.A.
 
PDF
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
TheFamily
 
PDF
Introduction to Docker, December 2014 "Tour de France" Edition
Jérôme Petazzoni
 
PPT
Docker introduction
Phuc Nguyen
 
PPTX
Introduction to Docker
Alan Forbes
 
PDF
Docker workshop 0507 Taichung
Paul Chao
 
PDF
手把手帶你學 Docker 入門篇
Philip Zheng
 
PDF
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
dotCloud
 
PDF
Docker
Brian Hogan
 
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
PDF
Preparing your dockerised application for production deployment
Dave Ward
 
PPTX
Docker
Cary Gordon
 
PDF
Docker for developers
sparkfabrik
 
PDF
Docker for developers
DrupalDay
 
Docker - Demo on PHP Application deployment
Arun prasath
 
Killer Docker Workflows for Development
Chris Tankersley
 
Introduction to Docker
Kuan Yen Heng
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
Gaetano Giunta
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
Java developer intro to environment management with vagrant puppet and docker
Getting value from IoT, Integration and Data Analytics
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Partner S.A.
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
TheFamily
 
Introduction to Docker, December 2014 "Tour de France" Edition
Jérôme Petazzoni
 
Docker introduction
Phuc Nguyen
 
Introduction to Docker
Alan Forbes
 
Docker workshop 0507 Taichung
Paul Chao
 
手把手帶你學 Docker 入門篇
Philip Zheng
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
dotCloud
 
Docker
Brian Hogan
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
Preparing your dockerised application for production deployment
Dave Ward
 
Docker
Cary Gordon
 
Docker for developers
sparkfabrik
 
Docker for developers
DrupalDay
 
Ad

More from André Rømcke (8)

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

Recently uploaded (20)

PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 

Dockerize your Symfony application - Symfony Live NYC 2014

  • 1. Dockerize your Symfony application Docker: What, Why and How with Symfony? Symfony Live New York, Oct 9-10 2014! By @andrerom, VP Engineering at eZ Systems AS
  • 2. Who am I? André Rømcke: • Heads Engineering (Dev, QA & Support) at eZ Systems AS • PHP for 9 years, started with frontend in 96 <blink>#dhtml</blink> • Currently living in Lyon, France but from ~Oslo, Norway ! eZ Systems AS: • Maker of eZ Publish since 2001 • Norwegian based but with offices in 7 countries and hiring • Professional partners & Community users in all corners of the world ! eZ Publish • A Open source Enterprise Content Management System • Started using Symfony in 2012 (5.0), will complete the migration to Symfony in 2015 (6.0) with new product name: eZ Platform
  • 4. What is Docker? Environment as Micro services ! LEGO for developers?
  • 5. What is Docker? Currently on docker.com: “Docker - An open platform for distributed applications for developers and sysadmins.” ! ! Docker Engine is built on LXC ( cgroups, namespaces, Apparmor/SELinux, …) and Union file system to provide a layered container image format that can run on any recent Linux distro. ! Docker Hub is a cloud service for sharing container images and automating workflows, free for public, paid for private.
  • 6. Concept: Layers “Docker Engine” However lets use a more relevant example…
  • 7. Concept: Layers PHP-CPHP-FPM ContainerNginx ContainerMySQL Container PHP Image Base Image Nginx ImageMySQL Image PHP-PHP-FPM Image PH Base Image Base Image Bas m e Container layer Container layer Container layer Conta yer Example: $ sudo docker run -d php-fpm:5.6 ! ! ! ! ! ! ! • Starts a php-fpm container based on a php-fpm image tagged “5.6”
 • The php-fpm image extends a plain php image, which again extends a base image like debian/ubuntu/centos
 • You can write to file system inside container, but changes in container is not persisted when replaced with new version of image unless using volumes
  • 8. Concept: DockerFile • Defines a Docker image • A bit like VagrantFile meets Puppet/Chef/Anisibel, but using shell ! • $ sudo docker build -t apache .
 FROM debian:wheezy MAINTAINER Some Maintainer "docker-maint@docker" ! RUN apt-get -y install apache2 ! ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ! EXPOSE 80 ! CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
  • 9. • Just like you are used to with Vagrant or VM’s you can map ports to keep images generic ! • $ sudo docker run -d -p 81:80 —name=web-1 php:5.6-apache Host! Listen: 80 Concept: Port Mapping *:80 80 81 82 www-1
 :80 www-2
 :80 Varnish
 :80 Note: no advantage having more then one www instance other then for cluster testing on one node
  • 10. • Just like you are used to with Vagrant or VM’s you can map ports to keep images generic ! • $ sudo docker run -d -p 81:80 —name=web-1 php:5.6-apache VM! Listen: 80 8080 localhost:8080 Concept: Port Mapping 80 81 82 www-1
 :80 www-2
 :80 Varnish
 :80 Note: no advantage having more then one www instance other then for cluster testing on one node
  • 11. • Shares exposed ports and environment variables from one container to another ! • $ sudo docker run -d -p 81:80 --link db-1:db (…) VM! Listen: 80 Concept: Container Linking 8080 localhost:8080 80 81 82 www-1
 :80 www-2
 :80 db-1
 :3306 Varnish
 :80
  • 12. • Mounts a folder in Host/VM to a container • Can be read only or read-write ! • $ sudo docker run -v /vagrant/www:/www:rw —name=sf-vol (…) VM! Listen: 80 Concept: Data Volume 8080 localhost:8080 vagrant/files/www 80 81 82 www-1
 :80 www-2
 :80 db-1
 :3306 sf-volrw Varnish
 :80
  • 13. • Mounts all volumes in one container to others • Can be read only or read-write ! • $ sudo docker run -d -p 81:80 --volumes-from sf-vol (…) VM! Listen: 80 Concept: Sharing Data Volume 80 81 82 8080 localhost:8080 vagrant/files/www rw www-1
 :80 www-2
 :80 sf-vol db-1
 :3306 Varnish
 :80
  • 14. How does it compare to VM’s? Virtual Machines vs Docker App A App B Bin/Libs Bin/Libs Guest OS Guest OS HyperVisor Host OS Server App A App B Bin/Libs Bin/Libs Guest OS Guest OS “Docker Engine” Host OS Server
  • 15. How does it compare to VM’s? Virtual Machines vs Docker App A App B Bin/Libs Bin/Libs Guest OS Guest OS HyperVisor Host OS Server App A App B Bin/Libs Bin/Libs Guest OS Guest OS “Docker Engine” Host OS ServerClose to zero run time overhead!
  • 16. How does it compare to VM’s? App A App B Bin/Libs Bin/Libs Guest OS Guest OS “Docker Engine” Host OS Server Virtual Machines vs Docker App A App B Bin/Libs Bin/Libs Guest OS Guest OS HyperVisor Host OS Server “Machine” boots in less then a second Close to zero run time overhead!
  • 17. App A App B Bin/Libs Bin/Libs Guest OS Guest OS “Docker Engine” Host OS Server How does it compare to VM’s? Virtual Machines vs Docker App A App B Bin/Libs Bin/Libs Guest OS Guest OS HyperVisor Host OS Server Close to zero run time overhead! Shared “layers” share memory “Machine” boots in less then a second
  • 18. App A App B Bin/Libs Bin/Libs Guest OS Guest OS “Docker Engine” Host OS Server How does it compare to VM’s? Virtual Machines vs Docker App A App B Bin/Libs Bin/Libs Guest OS Guest OS HyperVisor Host OS Server Close to zero run time overhead! Image size advantage; i.e. OS image only downloaded once Shared “layers” share memory “Machine” boots in less then a second
  • 20. Why? Docker holds the promise of: • Stable official containers for everything* you need on Docker Hub • No need to care about OS/Linux-distro differences anymore • Develop once, use and deploy everywhere • Less need for using abstracted install recipes using Puppet/Chef/ Ansible** • Can replace capistrano, capifony, …. ! ! ! ! * Not yet, but getting there. Example: v1 of PHP container out recently ** However they are still very valid for configuration of your app
  • 21. Example: Not unrealistic that we will have a standard docker config ala fig which can be used on: Azure, Google Computer, Server, localhost, … ! How fig.yml currently looks like: web-1: image: php:5.6-apache ports: - "80:80" links: - db-1 volumes: - /vagrant/volumes/ezpublish:/var/www:rw db-1: image: mysql:5.6 environment: MYSQL_ROOT_PASSWORD: mysecretpassword Why? Check out Google Kubernetes!
 Already supported by Google and Azure.
  • 22. Why? Highly scalable: • “By forcing you to split out application in micro services it allows you to scale up part of the application very easily!”
 
 GOTO: • Google Kubernetes (for use on own, Azure or GoogleCloudPlatform) • Apache Mesos + Marathon • …Docker slides from DockerCon for more alternatives…
  • 23. High level Benefits Lets Developers iterate on environment like on code: • Develop & Use locally • Use for test system keeping test server clean • Deploy/Deliver to Ops/Sysadmins • $um: Run everywhere ! Allows Ops/Sysadmins to standardize around containers: • Can focus on maintain hosts, scaling, monitoring • Streamlined Deployments ! Benefits for your business: • Standardize environments & deployments across developers, whole organization and customers • Opportunity: new marketplace for your application • Operation Cost
  • 24. Examples of use and CI/CD
  • 25. Example: Single app, one node Server / VM Varnish www-1 sf-vol db-vol php- fpm-1 db-1 Example of this: Note for running Symfony-standard on this: • Rename app.php or app_dev.php to index.php, or change the rewrite rules • VagrantFile: Comment out d.run command for ezpublish:prepare • Correct settings in files/vagrant.yml
  • 26. Example: Single app, Cluster testing on one node Server / VM Varnish www-1 www-2 php- fpm-2 sf-vol db-vol php- fpm-1 db-1
  • 27. Example: Single app, several nodes Web Server / VM 1 www-1 sf-vol php- fpm-1 redis-1 load- balancer Data- base Binary storage Web Server / VM 2 www-2 sf-vol php- fpm-2 redis-2 Web Server / VM 3 sf-vol Adding nodes on dem and
  • 28. Example: Multiple apps, several nodes “PAAS” Web Server / VM 1 load- balancer Data- base Binary storage Adding nodes on dem and App N www sf-vol php- fpm redis App 3 www sf-vol php- fpm redis App 4 www sf-vol php- fpm redis App 1 www sf-vol php- fpm redis App 2 www sf-vol php- fpm redis Web Server / VM 2 App N www sf-vol php- fpm redis App 3 www sf-vol php- fpm redis App 4 www sf-vol php- fpm redis App 1 www sf-vol php- fpm redis App 2 www sf-vol php- fpm redis Web Server / VM 3 App 3 www sf-vol php- redis
  • 29. Continues Integration and Deployment? Docker Hub (Public/Private)All tests merge publish image symfony-standard pull latests stable parent image Symfony-standard on Docker Hub?
  • 30. Continues Integration and Deployment? Own containers (optional) Docker Hub (Public/Private) merge publish image Code Test on stable image merge deploy updated image Server / ! Azure /! Google Cloud /! … pull latests stable code Custom project Test on stable code pull latests stable image Note: Also checkout Pablo Godel’s talk “Rock Solid Deployment of Symfony Apps”
  • 31. The End Resources: • registry.hub.docker.com (Official and community made containers) • github.com/ezsystems/ezpublish-docker (referred to in slides) • ez.no/Blog/What-is-Docker-and-why-should-I-care ! • Running Docker on cluster: • https://github.com/GoogleCloudPlatform/kubernetes • mesosphere.com/learn/ • aws.amazon.com/blogs/aws/container-computing/ ! Twitter: @andrerom Joined.in: https://joind.in/12188 ! PS: eZ launches 100% Symfony CMS in 2015 called eZ Platform based on todays “New/Symfony stack” in eZ Publish 5.x