Docker - Demo on PHP Application deployment

Arun prasath
Arun prasathDevOps Engineer em Endurance International Group
Introduction to Docker
Demo on PHP Application deployment
Arun prasath S
April, 2014
Static website
Web frontend
User DB
Queue Analytics DB
Background workers
API endpoint
nginx 1.5 + modsecurity + openssl + bootstrap 2
postgresql + pgv8 + v8
hadoop + hive + thrift + OpenJDK
Ruby + Rails + sass + Unicorn
Redis + redis-sentinel
Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs +
phantomjs
Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client
Development VM
QA server
Public Cloud
Disaster recovery
Contributor’s laptop
Production Servers
The ChallengeMultiplicityofStacksMultiplicityof
hardware
environments
Production Cluster
Customer Data Center
Doservicesandapps
interact
appropriately?
CanImigrate
smoothlyand
quickly?
Static website Web frontendUser DB Queue Analytics DB
Development
VM QA server
Public Cloud
Contributor’s
laptop
Docker is a shipping container system for codeMultiplicityofStacks
Multiplicityof
hardware
environments
Production
Cluster
Customer Data
Center
Doservicesandapps
interact
appropriately?
CanImigrate
smoothlyandquickly
…that can be manipulated using
standard operations and run
consistently on virtually any hardware
platform
An engine that enables any
payload to be encapsulated as a
lightweight, portable, self-
sufficient container…
Why Developers Care
Build once…(finally) run anywhere*
• A clean, safe, hygienic and portable runtime environment for your app.
• No worries about missing dependencies, packages and other pain points during
subsequent deployments.
• Run each app in its own isolated container, so you can run various versions of libraries and
other dependencies for each app without worrying
• Automate testing, integration, packaging…anything you can script
• Reduce/eliminate concerns about compatibility on different platforms, either your own or
your customers.
• Cheap, zero-penalty containers to deploy services? A VM without the overhead of a VM?
Instant replay and reset of image snapshots? That’s the power of Docker
Why Devops Cares?
Configure once…run anything
• Make the entire lifecycle more efficient, consistent, and repeatable
• Increase the quality of code produced by developers.
• Eliminate inconsistencies between development, test, production, and customer
environments
• Support segregation of duties
• Significantly improves the speed and reliability of continuous deployment and continuous
integration systems
• Because the containers are so lightweight, address significant performance, costs,
deployment, and portability issues normally associated with VMs
Underlying Technology
• Namespaces (pid, net, ipc, mnt, uts)
• Control group
• UnionFS
Containers
App
A
Containers vs. VMs
Hypervisor (Type 2)
Host OS
Server
Guest
OS
Bins/
Libs
App
A’
Guest
OS
Bins/
Libs
App
B
Guest
OS
Bins/
Libs
AppA’
Docker
Host OS
Server
Bins/Libs
AppA
Bins/Libs
AppB
AppB’
AppB’
AppB’
VM
Container
Containers are isolated,
but share OS and, where
appropriate, bins/libraries
Guest
OS
Guest
OS
…result is significantly faster deployment,
much less overhead, easier migration,
faster restart
Why are Docker containers lightweight?
Bins/
Libs
App
A
Original App
(No OS to take
up space, resources,
or require restart)
AppΔ
Bins/
App
A
Bins/
Libs
App
A’
Guest
OS
Bins/
Libs
Modified App
Union file system allows
us to only save the diffs
Between container A
and container
A’
VMs
Every app, every copy of an
app, and every slight modification
of the app requires a new virtual server
App
A
Guest
OS
Bins/
Libs
Copy of
App
No OS.
Can Share
bins/libs
App
A
Guest
OS
Guest
OS
VMs Containers
What are the basics of the Docker system?
Source Code
Repository
Dockerfile
For
A
Docker Engine
Docker
Container
Image
Registry
Build
Docker
Host 2 OS (Linux)
ContainerA
ContainerB
ContainerC
ContainerA
Push
Search
Pull
Run
Host 1 OS (Linux)
Why containers matter
Physical Containers Docker
Content Agnostic The same container can hold almost any
type of cargo
Can encapsulate any payload and its
dependencies
Hardware Agnostic Standard shape and interface allow same
container to move from ship to train to
semi-truck to warehouse to crane
without being modified or opened
Using operating system primitives (e.g. LXC)
can run consistently on virtually any
hardware—VMs, bare metal, openstack,
public IAAS, etc.—without modification
Content Isolation and
Interaction
No worry about anvils crushing bananas.
Containers can be stacked and shipped
together
Resource, network, and content isolation.
Avoids dependency hell
Automation Standard interfaces make it easy to
automate loading, unloading, moving,
etc.
Standard operations to run, start, stop,
commit, search, etc. Perfect for devops: CI,
CD, autoscaling, hybrid clouds
Highly efficient No opening or modification, quick to
move between waypoints
Lightweight, virtually no perf or start-up
penalty, quick to move and manipulate
Separation of duties Shipper worries about inside of box,
carrier worries about outside of box
Developer worries about code. Ops worries
about infrastructure.
Usecases
Demo – PHP application deployment
In this demo, I will show how to build a apache image from a
Dockerfile and deploy a PHP application which is present in an
external folder using custom configuration files.
Requirements:
Linux OS with Docker installed
Demo quick run :
1) Download this folder or files from Git - https://github.com/bingoarunprasath/php-app-docker.git
2) Now build a image for app deployment. From the folder downloaded, run the command
docker build -t bingoarunprasath/php .
3) Run the image by this command
docker run -i -t -d -p 80 -v /root/php-app/www:/var/www bingoarunprasath/php /bin/bash
4) You can run as many instances you want by running the above command
5) Run docker ps command to see the launched container. Note down the port number. (in my case 49172)
6) Now you can see your web application by visiting
http://<your-host-ip>:49172 or
http://<your-container-ip>:80
(You can view your container ID by docker ps and can view your container IP by docker inspect <container-ID>)
Demo explained
Folder structure
php-app
|______apache2files------apache2.conf
| |___ports.conf -> Apache configuration files
|
|______Dockerfile -> Docker file for building image
|
|______www/ -> PHP Application folder
Demo explained
Dockerfile
# Set the base image to Ubuntu
FROM ubuntu  Base image
RUN apt-get update
# File Author / Maintainer
MAINTAINER Example Arun
RUN apt-get install apache2 –y  Installed Apache
# Copy the configuration files from host
ADD apache2files/apache2.conf /etc/apache2/apache2.conf  Configuration files are copied during image build
ADD apache2files/ports.conf /etc/apache2/ports.conf
# Expose the default port
EXPOSE 80
#CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]  These lines are not working, when new instance starts, cant start apache
#CMD service apache2 start
RUN echo 'service apache2 start ' > /etc/bash.bashrc  Hence I started apache this way ,
# Set default container command
#ENTRYPOINT /bin/bash
Demo explained
Commands
1) Build image by using the Dockerfile in the current folder
$ docker build -t bingoarunprasath/php-app .
2) Run an instance from image build
$ docker run -i -t -d -p 80 -v /root/php-app/www:/var/www bingoarunprasath/php-app /bin/bash
-v /root/php-app/www:/var/www  PHP files are mounted during instance launch, Hence different apps can be mounted using the
same image
1 de 16

Recomendados

Architecting .NET Applications for Docker and Container Based Deployments por
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsBen Hall
14.4K visualizações101 slides
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori por
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriThe Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriDocker, Inc.
22.3K visualizações117 slides
Docker Security workshop slides por
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
5.3K visualizações122 slides
Developing and Deploying PHP with Docker por
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
807 visualizações111 slides
PHP development with Docker por
PHP development with DockerPHP development with Docker
PHP development with DockerYosh de Vos
779 visualizações16 slides
Amazon Web Services and Docker por
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and DockerPaolo latella
3.7K visualizações17 slides

Mais conteúdo relacionado

Mais procurados

Docker and Windows: The State of the Union por
Docker and Windows: The State of the UnionDocker and Windows: The State of the Union
Docker and Windows: The State of the UnionElton Stoneman
4.6K visualizações21 slides
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A... por
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Alexey Petrov
7.4K visualizações45 slides
Docker Security Deep Dive by Ying Li and David Lawrence por
Docker Security Deep Dive by Ying Li and David LawrenceDocker Security Deep Dive by Ying Li and David Lawrence
Docker Security Deep Dive by Ying Li and David LawrenceDocker, Inc.
16.1K visualizações44 slides
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.) por
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Nils De Moor
4.2K visualizações30 slides
Docker for Developers - Part 1 by David Gageot por
Docker for Developers - Part 1 by David GageotDocker for Developers - Part 1 by David Gageot
Docker for Developers - Part 1 by David GageotDocker, Inc.
10.2K visualizações6 slides
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ... por
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...Docker, Inc.
929 visualizações47 slides

Mais procurados(20)

Docker and Windows: The State of the Union por Elton Stoneman
Docker and Windows: The State of the UnionDocker and Windows: The State of the Union
Docker and Windows: The State of the Union
Elton Stoneman4.6K visualizações
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A... por Alexey Petrov
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Alexey Petrov7.4K visualizações
Docker Security Deep Dive by Ying Li and David Lawrence por Docker, Inc.
Docker Security Deep Dive by Ying Li and David LawrenceDocker Security Deep Dive by Ying Li and David Lawrence
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.16.1K visualizações
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.) por Nils De Moor
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Nils De Moor4.2K visualizações
Docker for Developers - Part 1 by David Gageot por Docker, Inc.
Docker for Developers - Part 1 by David GageotDocker for Developers - Part 1 by David Gageot
Docker for Developers - Part 1 by David Gageot
Docker, Inc.10.2K visualizações
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ... por Docker, Inc.
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.929 visualizações
Docker in production: reality, not hype (OSCON 2015) por bridgetkromhout
Docker in production: reality, not hype (OSCON 2015)Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)
bridgetkromhout12K visualizações
Docker + Microservices in Production por Patrick Mizer
Docker + Microservices in ProductionDocker + Microservices in Production
Docker + Microservices in Production
Patrick Mizer398 visualizações
On-Demand Image Resizing from Part of the monolith to Containerized Microserv... por Docker, Inc.
On-Demand Image Resizing from Part of the monolith to Containerized Microserv...On-Demand Image Resizing from Part of the monolith to Containerized Microserv...
On-Demand Image Resizing from Part of the monolith to Containerized Microserv...
Docker, Inc.711 visualizações
Locally it worked! virtualizing docker por Sascha Brinkmann
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing docker
Sascha Brinkmann2.3K visualizações
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia por Docker, Inc.
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena TapiaFrom Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
Docker, Inc.606 visualizações
Continuous delivery with jenkins, docker and exoscale por Julia Mateo
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscale
Julia Mateo4.2K visualizações
Docker workshop por Michał Kurzeja
Docker workshopDocker workshop
Docker workshop
Michał Kurzeja532 visualizações
What’s New in Docker - Victor Vieux, Docker por Docker, Inc.
What’s New in Docker - Victor Vieux, DockerWhat’s New in Docker - Victor Vieux, Docker
What’s New in Docker - Victor Vieux, Docker
Docker, Inc.791 visualizações
Docker - 15 great Tutorials por Julien Barbier
Docker - 15 great TutorialsDocker - 15 great Tutorials
Docker - 15 great Tutorials
Julien Barbier7.8K visualizações
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo por Docker, Inc.
Docker for Developers - Part 2 by Borja Burgos and Fernando MayoDocker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker, Inc.10.1K visualizações
DockerCon EU 2015: Trading Bitcoin with Docker por Docker, Inc.
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with Docker
Docker, Inc.5.9K visualizações
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf por Julia Mateo
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconfContinuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Julia Mateo5.2K visualizações
Windows Server Containers- How we hot here and architecture deep dive por Docker, Inc.
Windows Server Containers- How we hot here and architecture deep diveWindows Server Containers- How we hot here and architecture deep dive
Windows Server Containers- How we hot here and architecture deep dive
Docker, Inc.8.4K visualizações
Docker Container As A Service - March 2016 por Patrick Chanezon
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
Patrick Chanezon3.5K visualizações

Similar a Docker - Demo on PHP Application deployment

Docker intro por
Docker introDocker intro
Docker introspiddy
1.2K visualizações24 slides
Docker - Portable Deployment por
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deploymentjavaonfly
1.9K visualizações31 slides
Docker-Intro por
Docker-IntroDocker-Intro
Docker-IntroSujai Sivasamy
101 visualizações20 slides
OpenStack Summit por
OpenStack SummitOpenStack Summit
OpenStack SummitDocker, Inc.
794 visualizações42 slides
Demystifying Containerization Principles for Data Scientists por
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDr Ganesh Iyer
198 visualizações92 slides
2 Linux Container and Docker por
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and DockerFabio Fumarola
8.1K visualizações68 slides

Similar a Docker - Demo on PHP Application deployment (20)

Docker intro por spiddy
Docker introDocker intro
Docker intro
spiddy1.2K visualizações
Docker - Portable Deployment por javaonfly
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
javaonfly1.9K visualizações
Docker-Intro por Sujai Sivasamy
Docker-IntroDocker-Intro
Docker-Intro
Sujai Sivasamy101 visualizações
OpenStack Summit por Docker, Inc.
OpenStack SummitOpenStack Summit
OpenStack Summit
Docker, Inc.794 visualizações
Demystifying Containerization Principles for Data Scientists por Dr Ganesh Iyer
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data Scientists
Dr Ganesh Iyer198 visualizações
2 Linux Container and Docker por Fabio Fumarola
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and Docker
Fabio Fumarola8.1K visualizações
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013 por dotCloud
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
dotCloud6.7K visualizações
Linux containers and docker por Fabio Fumarola
Linux containers and dockerLinux containers and docker
Linux containers and docker
Fabio Fumarola1.9K visualizações
Develop with linux containers and docker por Fabio Fumarola
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and docker
Fabio Fumarola1.4K visualizações
Docker & Daily DevOps por Satria Ady Pradana
Docker & Daily DevOpsDocker & Daily DevOps
Docker & Daily DevOps
Satria Ady Pradana128 visualizações
Docker and-daily-devops por Satria Ady Pradana
Docker and-daily-devopsDocker and-daily-devops
Docker and-daily-devops
Satria Ady Pradana1.1K visualizações
Docker Introduction por Jeffrey Ellin
Docker IntroductionDocker Introduction
Docker Introduction
Jeffrey Ellin631 visualizações
Dockers and kubernetes por Dr Ganesh Iyer
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetes
Dr Ganesh Iyer3.1K visualizações
Docker, a new LINUX container technology based light weight virtualization por Suresh Balla
Docker, a new LINUX container technology based light weight virtualizationDocker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualization
Suresh Balla4.9K visualizações
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic... por Codemotion
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...
Codemotion765 visualizações
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12 por dotCloud
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
dotCloud4.9K visualizações
Application Deployment on Openstack por Docker, Inc.
Application Deployment on OpenstackApplication Deployment on Openstack
Application Deployment on Openstack
Docker, Inc.4.8K visualizações
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on... por Patrick Chanezon
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Patrick Chanezon893 visualizações
Docker-v3.pdf por Bruno Cornec
Docker-v3.pdfDocker-v3.pdf
Docker-v3.pdf
Bruno Cornec24 visualizações

Mais de Arun prasath

Managing Microservices traffic using Istio por
Managing Microservices traffic using IstioManaging Microservices traffic using Istio
Managing Microservices traffic using IstioArun prasath
665 visualizações23 slides
Istio por
Istio Istio
Istio Arun prasath
588 visualizações22 slides
Elk with Openstack por
Elk with OpenstackElk with Openstack
Elk with OpenstackArun prasath
1.7K visualizações17 slides
Openstack Heat por
Openstack HeatOpenstack Heat
Openstack HeatArun prasath
3.4K visualizações26 slides
HP CloudSystem Matrix por
HP CloudSystem MatrixHP CloudSystem Matrix
HP CloudSystem MatrixArun prasath
2.5K visualizações18 slides
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS por
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMSARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMSArun prasath
1.5K visualizações14 slides

Mais de Arun prasath(9)

Managing Microservices traffic using Istio por Arun prasath
Managing Microservices traffic using IstioManaging Microservices traffic using Istio
Managing Microservices traffic using Istio
Arun prasath665 visualizações
Istio por Arun prasath
Istio Istio
Istio
Arun prasath588 visualizações
Elk with Openstack por Arun prasath
Elk with OpenstackElk with Openstack
Elk with Openstack
Arun prasath1.7K visualizações
Openstack Heat por Arun prasath
Openstack HeatOpenstack Heat
Openstack Heat
Arun prasath3.4K visualizações
HP CloudSystem Matrix por Arun prasath
HP CloudSystem MatrixHP CloudSystem Matrix
HP CloudSystem Matrix
Arun prasath2.5K visualizações
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS por Arun prasath
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMSARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
Arun prasath1.5K visualizações
Highly confidential security system - sole survivors - SRS por Arun prasath
Highly confidential security system  - sole survivors - SRSHighly confidential security system  - sole survivors - SRS
Highly confidential security system - sole survivors - SRS
Arun prasath5.2K visualizações
Toll application - .NET and Android - SRS por Arun prasath
Toll application - .NET and Android - SRSToll application - .NET and Android - SRS
Toll application - .NET and Android - SRS
Arun prasath10.9K visualizações
Toll app - Android project por Arun prasath
Toll app - Android projectToll app - Android project
Toll app - Android project
Arun prasath7.2K visualizações

Último

Software testing company in India.pptx por
Software testing company in India.pptxSoftware testing company in India.pptx
Software testing company in India.pptxSakshiPatel82
7 visualizações9 slides
Roadmap y Novedades de producto por
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de productoNeo4j
50 visualizações33 slides
HarshithAkkapelli_Presentation.pdf por
HarshithAkkapelli_Presentation.pdfHarshithAkkapelli_Presentation.pdf
HarshithAkkapelli_Presentation.pdfharshithakkapelli
11 visualizações16 slides
MariaDB stored procedures and why they should be improved por
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedFederico Razzoli
8 visualizações32 slides
Software evolution understanding: Automatic extraction of software identifier... por
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...Ra'Fat Al-Msie'deen
7 visualizações33 slides
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM... por
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...Deltares
7 visualizações40 slides

Último(20)

Software testing company in India.pptx por SakshiPatel82
Software testing company in India.pptxSoftware testing company in India.pptx
Software testing company in India.pptx
SakshiPatel827 visualizações
Roadmap y Novedades de producto por Neo4j
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de producto
Neo4j50 visualizações
HarshithAkkapelli_Presentation.pdf por harshithakkapelli
HarshithAkkapelli_Presentation.pdfHarshithAkkapelli_Presentation.pdf
HarshithAkkapelli_Presentation.pdf
harshithakkapelli11 visualizações
MariaDB stored procedures and why they should be improved por Federico Razzoli
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Federico Razzoli8 visualizações
Software evolution understanding: Automatic extraction of software identifier... por Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
Ra'Fat Al-Msie'deen7 visualizações
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM... por Deltares
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
Deltares7 visualizações
Advanced API Mocking Techniques por Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 visualizações
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... por Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri711 visualizações
Unleash The Monkeys por Jacob Duijzer
Unleash The MonkeysUnleash The Monkeys
Unleash The Monkeys
Jacob Duijzer7 visualizações
WebAssembly por Jens Siebert
WebAssemblyWebAssembly
WebAssembly
Jens Siebert33 visualizações
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... por Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 visualizações
Fleet Management Software in India por Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 visualizações
Winter '24 Release Chat.pdf por melbourneauuser
Winter '24 Release Chat.pdfWinter '24 Release Chat.pdf
Winter '24 Release Chat.pdf
melbourneauuser9 visualizações
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon por Deltares
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
Deltares13 visualizações
Copilot Prompting Toolkit_All Resources.pdf por Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana6 visualizações
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema por Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares17 visualizações
A first look at MariaDB 11.x features and ideas on how to use them por Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli45 visualizações
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit... por Deltares
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...
Deltares13 visualizações
Consulting for Data Monetization Maximizing the Profit Potential of Your Data... por Flexsin
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Flexsin 15 visualizações
Tridens DevOps por Tridens
Tridens DevOpsTridens DevOps
Tridens DevOps
Tridens9 visualizações

Docker - Demo on PHP Application deployment

  • 1. Introduction to Docker Demo on PHP Application deployment Arun prasath S April, 2014
  • 2. Static website Web frontend User DB Queue Analytics DB Background workers API endpoint nginx 1.5 + modsecurity + openssl + bootstrap 2 postgresql + pgv8 + v8 hadoop + hive + thrift + OpenJDK Ruby + Rails + sass + Unicorn Redis + redis-sentinel Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs + phantomjs Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client Development VM QA server Public Cloud Disaster recovery Contributor’s laptop Production Servers The ChallengeMultiplicityofStacksMultiplicityof hardware environments Production Cluster Customer Data Center Doservicesandapps interact appropriately? CanImigrate smoothlyand quickly?
  • 3. Static website Web frontendUser DB Queue Analytics DB Development VM QA server Public Cloud Contributor’s laptop Docker is a shipping container system for codeMultiplicityofStacks Multiplicityof hardware environments Production Cluster Customer Data Center Doservicesandapps interact appropriately? CanImigrate smoothlyandquickly …that can be manipulated using standard operations and run consistently on virtually any hardware platform An engine that enables any payload to be encapsulated as a lightweight, portable, self- sufficient container…
  • 4. Why Developers Care Build once…(finally) run anywhere* • A clean, safe, hygienic and portable runtime environment for your app. • No worries about missing dependencies, packages and other pain points during subsequent deployments. • Run each app in its own isolated container, so you can run various versions of libraries and other dependencies for each app without worrying • Automate testing, integration, packaging…anything you can script • Reduce/eliminate concerns about compatibility on different platforms, either your own or your customers. • Cheap, zero-penalty containers to deploy services? A VM without the overhead of a VM? Instant replay and reset of image snapshots? That’s the power of Docker
  • 5. Why Devops Cares? Configure once…run anything • Make the entire lifecycle more efficient, consistent, and repeatable • Increase the quality of code produced by developers. • Eliminate inconsistencies between development, test, production, and customer environments • Support segregation of duties • Significantly improves the speed and reliability of continuous deployment and continuous integration systems • Because the containers are so lightweight, address significant performance, costs, deployment, and portability issues normally associated with VMs
  • 6. Underlying Technology • Namespaces (pid, net, ipc, mnt, uts) • Control group • UnionFS Containers
  • 7. App A Containers vs. VMs Hypervisor (Type 2) Host OS Server Guest OS Bins/ Libs App A’ Guest OS Bins/ Libs App B Guest OS Bins/ Libs AppA’ Docker Host OS Server Bins/Libs AppA Bins/Libs AppB AppB’ AppB’ AppB’ VM Container Containers are isolated, but share OS and, where appropriate, bins/libraries Guest OS Guest OS …result is significantly faster deployment, much less overhead, easier migration, faster restart
  • 8. Why are Docker containers lightweight? Bins/ Libs App A Original App (No OS to take up space, resources, or require restart) AppΔ Bins/ App A Bins/ Libs App A’ Guest OS Bins/ Libs Modified App Union file system allows us to only save the diffs Between container A and container A’ VMs Every app, every copy of an app, and every slight modification of the app requires a new virtual server App A Guest OS Bins/ Libs Copy of App No OS. Can Share bins/libs App A Guest OS Guest OS VMs Containers
  • 9. What are the basics of the Docker system? Source Code Repository Dockerfile For A Docker Engine Docker Container Image Registry Build Docker Host 2 OS (Linux) ContainerA ContainerB ContainerC ContainerA Push Search Pull Run Host 1 OS (Linux)
  • 10. Why containers matter Physical Containers Docker Content Agnostic The same container can hold almost any type of cargo Can encapsulate any payload and its dependencies Hardware Agnostic Standard shape and interface allow same container to move from ship to train to semi-truck to warehouse to crane without being modified or opened Using operating system primitives (e.g. LXC) can run consistently on virtually any hardware—VMs, bare metal, openstack, public IAAS, etc.—without modification Content Isolation and Interaction No worry about anvils crushing bananas. Containers can be stacked and shipped together Resource, network, and content isolation. Avoids dependency hell Automation Standard interfaces make it easy to automate loading, unloading, moving, etc. Standard operations to run, start, stop, commit, search, etc. Perfect for devops: CI, CD, autoscaling, hybrid clouds Highly efficient No opening or modification, quick to move between waypoints Lightweight, virtually no perf or start-up penalty, quick to move and manipulate Separation of duties Shipper worries about inside of box, carrier worries about outside of box Developer worries about code. Ops worries about infrastructure.
  • 12. Demo – PHP application deployment In this demo, I will show how to build a apache image from a Dockerfile and deploy a PHP application which is present in an external folder using custom configuration files. Requirements: Linux OS with Docker installed
  • 13. Demo quick run : 1) Download this folder or files from Git - https://github.com/bingoarunprasath/php-app-docker.git 2) Now build a image for app deployment. From the folder downloaded, run the command docker build -t bingoarunprasath/php . 3) Run the image by this command docker run -i -t -d -p 80 -v /root/php-app/www:/var/www bingoarunprasath/php /bin/bash 4) You can run as many instances you want by running the above command 5) Run docker ps command to see the launched container. Note down the port number. (in my case 49172) 6) Now you can see your web application by visiting http://<your-host-ip>:49172 or http://<your-container-ip>:80 (You can view your container ID by docker ps and can view your container IP by docker inspect <container-ID>)
  • 14. Demo explained Folder structure php-app |______apache2files------apache2.conf | |___ports.conf -> Apache configuration files | |______Dockerfile -> Docker file for building image | |______www/ -> PHP Application folder
  • 15. Demo explained Dockerfile # Set the base image to Ubuntu FROM ubuntu  Base image RUN apt-get update # File Author / Maintainer MAINTAINER Example Arun RUN apt-get install apache2 –y  Installed Apache # Copy the configuration files from host ADD apache2files/apache2.conf /etc/apache2/apache2.conf  Configuration files are copied during image build ADD apache2files/ports.conf /etc/apache2/ports.conf # Expose the default port EXPOSE 80 #CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]  These lines are not working, when new instance starts, cant start apache #CMD service apache2 start RUN echo 'service apache2 start ' > /etc/bash.bashrc  Hence I started apache this way , # Set default container command #ENTRYPOINT /bin/bash
  • 16. Demo explained Commands 1) Build image by using the Dockerfile in the current folder $ docker build -t bingoarunprasath/php-app . 2) Run an instance from image build $ docker run -i -t -d -p 80 -v /root/php-app/www:/var/www bingoarunprasath/php-app /bin/bash -v /root/php-app/www:/var/www  PHP files are mounted during instance launch, Hence different apps can be mounted using the same image