SlideShare a Scribd company logo
Dockerizing
Symfony2
application
Roman R.
Who am I?
Roman Rodomansky
itspoma@gmail.com
- Software Engineer at EPAM (more Dev than Ops)
- @founder of 2enota, and of adbar
- @co-organizer Lviv GDG
github.com/itspoma
skype: roman.rodomanskyy
linkedin.com/in/rodomansky
Questions
- who has tried Vagrant?
- who has tried Docker? (online tutorial)
- who has tried the real Docker? (deployed remote VM)
- Installed Docker locally? (under the boot2docker, or Vagrant)
- Who has written a Dockerfile? (and built it)
- An published image on Docker Hub?
- Deployed Docker image for stage?
● why Docker is so cool (container madness)
● what is Docker (and why it matters)
● what are Containers (w/ background)
● the Docker ecosystem (w/ tools)
● dockerizing Symfony2 application workflow
Agenda
Docker
is a trend
The problems
The problems
- application deploy harder than could be
- application can’t run, by reason of differences in environments
- deploying machines separately from applications
- used entire operating systems to deploy (with all of the security footprint that they entail)
- heavy-weight virtualized servers without specifying CPU/memory/etc
- make a magic button to “publish app anywhere”
- container management
- different deployment mechanisms for custom nodes
The isolation problem
Project A: zend server, mysql, php 5.3
Project B: apache2, postresql, php 5.4, rabbitmq
Project C: apache2, mysql, php 5.6, oracle, solr, ldap
Hypervisor or Not?
vs VM
Speed:
VBox -> 1 min
docker -> 0.3 sec
Memory:
VBox -> 256 Mb
docker -> 1 Mb
Disk quota:
VBox: 1 Gb
docker: 100 kb
LinuX Containers
has been present in Linux kernels for 5+ years and now is considered fairly mature
others:
- lmctfy Let Me Contain That For You (Google)
- libcontainer (Docker)
Background: LXC
Background: namespaces
separate namespaces for containers
own mount
own net namespace (network interfaces)
own uts namespace (hostname)
own ipc namespace
own user namespace (mapping uid-s between inside/outside of)
Control Cgroups
is a Linux kernel feature
that limits and isolates the resource usage (CPU, memory, disk I/O, network, etc) of a collection of processes
Google engineers started work on this feature in 2006 under the name “process containers”
in 2007 changed name to “control groups”
the goal - to provide a unified interface to many different use cases
- memory
- cpu
- blkio
- devices
Background: cgroups
Build,
Ship,
Run
Any Application
Anywhere
- Build: package your application in a container
- Ship: move that container from a machine to another
- Run: execute that container
- Any application: anything that runs on Linux
- Anywhere: local VM, cloud instance, raspberry pi, baremetal...
The Idea
Hello, Docker. Who are you?
tool for managing LXC containers
client / hub
What is a Docker Container?
- high level = is a small virtual machine
- with own process space, network interface
- can run staff as root
- low level = it is a chroot on a steroids
- isolation with namespaces
- limitation by cgroups (own mount, own
- A container is a single service in a larger application
- a web server (e.g., nginx)
- an application server (e.g., PHP-FPM)
- need a database server (e.g., MySQL)
- Each of these services can be separated into its own Docker container
What is a Docker Image?
Imagine a Docker image
as a PHP class
bash$ docker search centos
https://registry.hub.docker.com/
https://registry.hub.docker.com/_/centos/
bash$ docker push # image to the Hub
bash$ docker pull # this image from any machine
is a cloud for sharing container images and automating workflows
free for public
paid for private
metadata + archives
similar to Git commits structure
What is a Docker Hub?
$ docker run -ti ubuntu /bin/bash
$ docker run -ti debian /bin/bash
$ docker run -ti fedora bash
$ docker run -ti centos bash
Your First Container
$ docker search centos
$ docker run --rm -ti centos:7 bash
$ docker run --rm -ti centos:6 bash
$ docker run --rm -ti centos:5 bash
root@container:/# cat /etc/issue
Building a Server with Dockerfile
- receipe to build a container
- start FROM a base image
- RUN commands on top of it
- easy to learn, easy to use
Dockerfile example
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y nginx
EXPOSE 80
bash$ docker build -t example/nginx .
bash$ docker run -d -P example/nginx
Stop!
Demo time
show “simple-container”
https://github.com/itspoma/docker-symfony2/tree/master/env/simple-container/
demo time
(single container)
Finally, run the web server
docker run -p 80:80 -d nginx-example
docker ps
docker run -v /home/core/share:/var/www:rw -p 80:80 -d
nginx-example
docker inspect <Container ID>
Linking Containers
if containers need to communicate with eachother
if your application container needs to communiate with a database container
$ docker run -p 3306:3306 -name mysql -d some-mysql-image
$ docker run -p 80:80 -link mysql:db -d some-application-image
$ env | grep MYSQL
MYSQL_PORT_3306_TCP_ADDR=172.17.0.8
MYSQL_PORT_3306_TCP_PORT=3306
demo time
(multiple container)
Docker ecosystem
Docker Engine
open-source tool, written in Go, runs as a daemon, comes with a CLI, has a REST API
Docker Hub
registry of services, public/private repos, automated builds
Docker community
> 600 contributors
~20 core mainainers
> 50k repos on Docker Hub
Docker Compose
Docker Machine
Docker Swarm
Docker Machine
Automatically setups up Docker
on your computer,
on cloud providers,
and inside your data center.
Can provisione any host.
bash$ docker-machine create -d virtualbox dev
bash$ docker-machine create -d digitalocean dev
Docker Swarm
Provides native clustering capabilities to turn a
group of Docker engines into a single, virtual Docker
Engine.
run your stack with one command: docker-compose up
describe your stack with one file: docker-compose.yml
# docker-compose.yml
web:
image: php:5.6-apache
links:
- db:db
volumes:
- .:/var/www/html
db:
image: postgres
Docker Compose
demo time
(using Compose)
And, push it to the stage
git clone http://github/repo.git
docker-compose up -d
Zero DownTime
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
images List images
history Show the history of an image
images List images
inspect Return low-level information on a container or image
port Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
ps List containers
...
Making Docker commands
1) The Shared Base Container(s)
2) The Shared Volume Dev Container
3) The Dev Tools Container
4) The Test In A Different Environment containers
5) The Build Container
6) The Installation Container
7) The Default-Service-In-A-Box Containers
8) The Infrastructure / Glue Containers
Docker development patterns
● docker stats (built-in)
● CAdvisor (available as container, free)
● Scout (SASS, paid)
● Data Dog (SASS, free)
● Sensu (container, free)
Containers Monitoring
$ docker stats 18ef566e1cba 61403b48f054 e1d1e09f0dc1
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
18ef566e1cba 0.44% 264.7 MiB/1.957 GiB 13.21% 1.988 KiB/648 B
61403b48f054 0.00% 684 KiB/1.957 GiB 0.03% 2.32 KiB/648 B
e1d1e09f0dc1 0.01% 17.85 MiB/1.957 GiB 0.89% 5.158 KiB/40.1 KiB
Containers Monitoring: docker stats
docker run 
--volume=/:/rootfs:ro 
--volume=/var/run:/var/run:rw 
--volume=/sys:/sys:ro 
--volume=/var/lib/docker/:/var/lib/docker:ro 
--publish=8080:8080 
--detach=true 
--name=cadvisor 
google/cadvisor:latest
$ open http://$(boot2docker ip):8080/
Containers Monitoring: CAdvisor
Resources
- Docker Cheat
Sheet https://github.com/wsargent/docker-cheat-sheet
- Docker for Developers - Jérôme Petazzoni
https://www.youtube.com/watch?v=FdkNAjjO5yQ
- https://github.com/veggiemonk/awesome-docker
Sources: https://github.com/itspoma/docker-symfony2
Summary
With Docker, you can:
- you fairly easily can build servers
- put your software into container
- run those containers anywhere
- write receipes to automatically build containers
- automate testing, building, hosting using the Docker Hub
Everything in the environment is under your control
ship the entire environment instead of just code!
The end.
Thanks!

More Related Content

What's hot

Using docker to develop NAS applications
Using docker to develop NAS applicationsUsing docker to develop NAS applications
Using docker to develop NAS applications
Terry Chen
 
Intro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and WindowsIntro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and Windows
Thomas Chacko
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015
Leonid Mirsky
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
bridgetkromhout
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
Ruoshi Ling
 
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server ContainersDocker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Anthony Chu
 
Native Containers on Windows 10 & Windows Server 2016 using Docker
Native Containers on Windows 10 & Windows Server 2016 using DockerNative Containers on Windows 10 & Windows Server 2016 using Docker
Native Containers on Windows 10 & Windows Server 2016 using Docker
Jorge Arteiro
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
謝 宗穎
 
Docker up and running
Docker up and runningDocker up and running
Docker up and running
Victor S. Recio
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
Sreenivas Makam
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지
충섭 김
 
Exploring Docker Security
Exploring Docker SecurityExploring Docker Security
Exploring Docker Security
Patrick Kleindienst
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
kao kuo-tung
 
The How and Why of Windows containers
The How and Why of Windows containersThe How and Why of Windows containers
The How and Why of Windows containers
Ben Hall
 
Docker composeで開発環境をメンバに配布せよ
Docker composeで開発環境をメンバに配布せよDocker composeで開発環境をメンバに配布せよ
Docker composeで開発環境をメンバに配布せよ
Yusuke Kon
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview
Thomas Chacko
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
Luciano Fiandesio
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by Docker
Terry Chen
 

What's hot (20)

Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Using docker to develop NAS applications
Using docker to develop NAS applicationsUsing docker to develop NAS applications
Using docker to develop NAS applications
 
Intro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and WindowsIntro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and Windows
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
 
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server ContainersDocker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server Containers
 
Native Containers on Windows 10 & Windows Server 2016 using Docker
Native Containers on Windows 10 & Windows Server 2016 using DockerNative Containers on Windows 10 & Windows Server 2016 using Docker
Native Containers on Windows 10 & Windows Server 2016 using Docker
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Docker up and running
Docker up and runningDocker up and running
Docker up and running
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지
 
Exploring Docker Security
Exploring Docker SecurityExploring Docker Security
Exploring Docker Security
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
 
The How and Why of Windows containers
The How and Why of Windows containersThe How and Why of Windows containers
The How and Why of Windows containers
 
Docker composeで開発環境をメンバに配布せよ
Docker composeで開発環境をメンバに配布せよDocker composeで開発環境をメンバに配布せよ
Docker composeで開発環境をメンバに配布せよ
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by Docker
 

Similar to Dockerizing a Symfony2 application

ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ElasTest Project
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
Micael Gallego
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
Patrick Chanezon
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
Carlo Bonamico
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Codemotion
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
Paul Chao
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
Philip Zheng
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
양재동 코드랩
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
Taswar Bhatti
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
Guido Schmutz
 
Docker 2014
Docker 2014Docker 2014
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
Philip Zheng
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
Paul Chao
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
Vincent De Smet
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini Anand
PRIYADARSHINI ANAND
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
Henryk Konsek
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
RightScale
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
Liang Bo
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 

Similar to Dockerizing a Symfony2 application (20)

ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Docker 2014
Docker 2014Docker 2014
Docker 2014
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini Anand
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 

Recently uploaded

road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 

Recently uploaded (20)

road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 

Dockerizing a Symfony2 application

  • 1.
  • 3. Who am I? Roman Rodomansky itspoma@gmail.com - Software Engineer at EPAM (more Dev than Ops) - @founder of 2enota, and of adbar - @co-organizer Lviv GDG github.com/itspoma skype: roman.rodomanskyy linkedin.com/in/rodomansky
  • 4. Questions - who has tried Vagrant? - who has tried Docker? (online tutorial) - who has tried the real Docker? (deployed remote VM) - Installed Docker locally? (under the boot2docker, or Vagrant) - Who has written a Dockerfile? (and built it) - An published image on Docker Hub? - Deployed Docker image for stage?
  • 5. ● why Docker is so cool (container madness) ● what is Docker (and why it matters) ● what are Containers (w/ background) ● the Docker ecosystem (w/ tools) ● dockerizing Symfony2 application workflow Agenda
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 13. The problems - application deploy harder than could be - application can’t run, by reason of differences in environments - deploying machines separately from applications - used entire operating systems to deploy (with all of the security footprint that they entail) - heavy-weight virtualized servers without specifying CPU/memory/etc - make a magic button to “publish app anywhere” - container management - different deployment mechanisms for custom nodes
  • 14. The isolation problem Project A: zend server, mysql, php 5.3 Project B: apache2, postresql, php 5.4, rabbitmq Project C: apache2, mysql, php 5.6, oracle, solr, ldap
  • 16. vs VM Speed: VBox -> 1 min docker -> 0.3 sec Memory: VBox -> 256 Mb docker -> 1 Mb Disk quota: VBox: 1 Gb docker: 100 kb
  • 17. LinuX Containers has been present in Linux kernels for 5+ years and now is considered fairly mature others: - lmctfy Let Me Contain That For You (Google) - libcontainer (Docker) Background: LXC
  • 18. Background: namespaces separate namespaces for containers own mount own net namespace (network interfaces) own uts namespace (hostname) own ipc namespace own user namespace (mapping uid-s between inside/outside of)
  • 19. Control Cgroups is a Linux kernel feature that limits and isolates the resource usage (CPU, memory, disk I/O, network, etc) of a collection of processes Google engineers started work on this feature in 2006 under the name “process containers” in 2007 changed name to “control groups” the goal - to provide a unified interface to many different use cases - memory - cpu - blkio - devices Background: cgroups
  • 21. - Build: package your application in a container - Ship: move that container from a machine to another - Run: execute that container - Any application: anything that runs on Linux - Anywhere: local VM, cloud instance, raspberry pi, baremetal... The Idea
  • 22. Hello, Docker. Who are you? tool for managing LXC containers client / hub
  • 23. What is a Docker Container? - high level = is a small virtual machine - with own process space, network interface - can run staff as root - low level = it is a chroot on a steroids - isolation with namespaces - limitation by cgroups (own mount, own - A container is a single service in a larger application - a web server (e.g., nginx) - an application server (e.g., PHP-FPM) - need a database server (e.g., MySQL) - Each of these services can be separated into its own Docker container
  • 24. What is a Docker Image? Imagine a Docker image as a PHP class
  • 25. bash$ docker search centos https://registry.hub.docker.com/ https://registry.hub.docker.com/_/centos/ bash$ docker push # image to the Hub bash$ docker pull # this image from any machine is a cloud for sharing container images and automating workflows free for public paid for private metadata + archives similar to Git commits structure What is a Docker Hub?
  • 26. $ docker run -ti ubuntu /bin/bash $ docker run -ti debian /bin/bash $ docker run -ti fedora bash $ docker run -ti centos bash Your First Container $ docker search centos $ docker run --rm -ti centos:7 bash $ docker run --rm -ti centos:6 bash $ docker run --rm -ti centos:5 bash root@container:/# cat /etc/issue
  • 27. Building a Server with Dockerfile - receipe to build a container - start FROM a base image - RUN commands on top of it - easy to learn, easy to use
  • 28. Dockerfile example FROM ubuntu:14.04 RUN apt-get update RUN apt-get install -y nginx EXPOSE 80 bash$ docker build -t example/nginx . bash$ docker run -d -P example/nginx Stop! Demo time show “simple-container” https://github.com/itspoma/docker-symfony2/tree/master/env/simple-container/
  • 30. Finally, run the web server docker run -p 80:80 -d nginx-example docker ps docker run -v /home/core/share:/var/www:rw -p 80:80 -d nginx-example docker inspect <Container ID>
  • 31. Linking Containers if containers need to communicate with eachother if your application container needs to communiate with a database container $ docker run -p 3306:3306 -name mysql -d some-mysql-image $ docker run -p 80:80 -link mysql:db -d some-application-image $ env | grep MYSQL MYSQL_PORT_3306_TCP_ADDR=172.17.0.8 MYSQL_PORT_3306_TCP_PORT=3306
  • 33. Docker ecosystem Docker Engine open-source tool, written in Go, runs as a daemon, comes with a CLI, has a REST API Docker Hub registry of services, public/private repos, automated builds Docker community > 600 contributors ~20 core mainainers > 50k repos on Docker Hub Docker Compose Docker Machine Docker Swarm
  • 34. Docker Machine Automatically setups up Docker on your computer, on cloud providers, and inside your data center. Can provisione any host. bash$ docker-machine create -d virtualbox dev bash$ docker-machine create -d digitalocean dev
  • 35. Docker Swarm Provides native clustering capabilities to turn a group of Docker engines into a single, virtual Docker Engine.
  • 36. run your stack with one command: docker-compose up describe your stack with one file: docker-compose.yml # docker-compose.yml web: image: php:5.6-apache links: - db:db volumes: - .:/var/www/html db: image: postgres Docker Compose
  • 38. And, push it to the stage git clone http://github/repo.git docker-compose up -d
  • 40. attach Attach to a running container build Build an image from a Dockerfile commit Create a new image from a container's changes diff Inspect changes on a container's filesystem events Get real time events from the server exec Run a command in a running container images List images history Show the history of an image images List images inspect Return low-level information on a container or image port Lookup the public-facing port that is NAT-ed to PRIVATE_PORT ps List containers ... Making Docker commands
  • 41. 1) The Shared Base Container(s) 2) The Shared Volume Dev Container 3) The Dev Tools Container 4) The Test In A Different Environment containers 5) The Build Container 6) The Installation Container 7) The Default-Service-In-A-Box Containers 8) The Infrastructure / Glue Containers Docker development patterns
  • 42. ● docker stats (built-in) ● CAdvisor (available as container, free) ● Scout (SASS, paid) ● Data Dog (SASS, free) ● Sensu (container, free) Containers Monitoring
  • 43. $ docker stats 18ef566e1cba 61403b48f054 e1d1e09f0dc1 CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O 18ef566e1cba 0.44% 264.7 MiB/1.957 GiB 13.21% 1.988 KiB/648 B 61403b48f054 0.00% 684 KiB/1.957 GiB 0.03% 2.32 KiB/648 B e1d1e09f0dc1 0.01% 17.85 MiB/1.957 GiB 0.89% 5.158 KiB/40.1 KiB Containers Monitoring: docker stats
  • 44. docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8080:8080 --detach=true --name=cadvisor google/cadvisor:latest $ open http://$(boot2docker ip):8080/ Containers Monitoring: CAdvisor
  • 45. Resources - Docker Cheat Sheet https://github.com/wsargent/docker-cheat-sheet - Docker for Developers - Jérôme Petazzoni https://www.youtube.com/watch?v=FdkNAjjO5yQ - https://github.com/veggiemonk/awesome-docker Sources: https://github.com/itspoma/docker-symfony2
  • 46. Summary With Docker, you can: - you fairly easily can build servers - put your software into container - run those containers anywhere - write receipes to automatically build containers - automate testing, building, hosting using the Docker Hub Everything in the environment is under your control ship the entire environment instead of just code!

Editor's Notes

  1. контейнерна революція hypervisors, containers, LXC
  2. модний новий тренд метрика
  3. шоб понять сколько весит попугай.. якшо міряти в ангулярах - то докер це пів-ангуляра
  4. наступна метрика - гібхаб
  5. includes not only the application - which may be only 10s of MB - and the necessary binaries and libraries, but also an entire guest operating system - which may weigh 10s of GB the Docker Engine container comprises just the application and its dependencies it runs as an isolated process in userspace on the host operating system, sharing the kernel with other containers. Thus, it enjoys the resource isolation and allocation benefits of VMs but is much more portable and efficient. Containers virtualize at the operating system level, Hypervisors virtualize at the hardware level. Containers can boot and be application-ready in less than 500ms Hypervisors boot according to the OS typically 20 seconds, depending on storage speed. Containers have less overhead than VMs
  6. there are many Linux container technologies but they all operate using the same principles of isolating an application space within an operating system Linux Containers rely on namespaces && cgroups (control groups)
  7. The Idea
  8. це не система віртуалізації це не ноухау любая случайность неизбежна -- если би кто пришел позже на 2-3 месяца, назвал бы по другому, и сделал бы то же самое на базе LXC (плохой интерфейс), в докере это исправили + гарантированное состояние сервиса (если собрали сервис в образ, залили - мы можем к нему потом откатится) + получить и упростить деплой (быстрый и простой) + минимальный даунтайм (уменьшить время деградации сервиса при обновлении) + простаивает оборудование + genuine application portability + using lightweight packages instead of a full VMs the idea that you starts from base container/image Docker adds a wrapper around containers that makes them easy to consume developers care about apps, operations cares about containers
  9. a little demo how docker is looked like docker is a cli thing A Docker container only stays alive as long as there is an active process being run in it. -t Allocate a (pseudo) tty, -i - Keep stdin open extramelly fast snapshots
  10. The Dockerfile provides a set of instructions for Docker to run on a container start run without learning a huge ton of documentation
  11. snapshots update and show build on updated RUN (reuse the s naptshot)
  12. Kitematic
  13. currently in beta It creates servers, installs Docker on them, then configures the Docker client to talk to them.
  14. you can scale out your application is a simple tool which controls a cluster of Docker hosts and exposes it as a single “virtual” host.
  15. many other orchestration tools