SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

PPTX
Docker and Windows: The State of the Union
Elton Stoneman
 
PPTX
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Alexey Petrov
 
PDF
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.
 
PDF
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Nils De Moor
 
PDF
Docker for Developers - Part 1 by David Gageot
Docker, Inc.
 
PDF
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
 
PDF
Docker in production: reality, not hype (OSCON 2015)
bridgetkromhout
 
PDF
Docker + Microservices in Production
Patrick Mizer
 
PDF
On-Demand Image Resizing from Part of the monolith to Containerized Microserv...
Docker, Inc.
 
PDF
Locally it worked! virtualizing docker
Sascha Brinkmann
 
PDF
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
Docker, Inc.
 
PDF
Continuous delivery with jenkins, docker and exoscale
Julia Mateo
 
PDF
Docker workshop
MichaƂ Kurzeja
 
PDF
What’s New in Docker - Victor Vieux, Docker
Docker, Inc.
 
PPTX
Docker - 15 great Tutorials
Julien Barbier
 
PDF
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker, Inc.
 
PDF
DockerCon EU 2015: Trading Bitcoin with Docker
Docker, Inc.
 
PDF
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Julia Mateo
 
PPTX
Windows Server Containers- How we hot here and architecture deep dive
Docker, Inc.
 
PPTX
Docker Container As A Service - March 2016
Patrick Chanezon
 
Docker and Windows: The State of the Union
Elton Stoneman
 
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Alexey Petrov
 
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Nils De Moor
 
Docker for Developers - Part 1 by David Gageot
Docker, Inc.
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
 
Docker in production: reality, not hype (OSCON 2015)
bridgetkromhout
 
Docker + Microservices in Production
Patrick Mizer
 
On-Demand Image Resizing from Part of the monolith to Containerized Microserv...
Docker, Inc.
 
Locally it worked! virtualizing docker
Sascha Brinkmann
 
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
Docker, Inc.
 
Continuous delivery with jenkins, docker and exoscale
Julia Mateo
 
Docker workshop
MichaƂ Kurzeja
 
What’s New in Docker - Victor Vieux, Docker
Docker, Inc.
 
Docker - 15 great Tutorials
Julien Barbier
 
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker, Inc.
 
DockerCon EU 2015: Trading Bitcoin with Docker
Docker, Inc.
 
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Julia Mateo
 
Windows Server Containers- How we hot here and architecture deep dive
Docker, Inc.
 
Docker Container As A Service - March 2016
Patrick Chanezon
 

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

PPTX
Docker - Portable Deployment
javaonfly
 
PDF
Introduction to Docker
Aditya Konarde
 
PDF
Docker Introduction
Jeffrey Ellin
 
PDF
Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up
JérÎme Petazzoni
 
PPTX
ma-formation-en-Docker-jlklk,nknkjn.pptx
imenhamada17
 
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
JérÎme Petazzoni
 
PDF
Scale Big With Docker — Moboom 2014
JérÎme Petazzoni
 
PPTX
Docker introduction
dotCloud
 
PDF
Dockerize your Symfony application - Symfony Live NYC 2014
André RÞmcke
 
PPTX
Intro Docker october 2013
dotCloud
 
PPTX
Intro to Docker November 2013
Docker, Inc.
 
PPT
Docker introduction
Phuc Nguyen
 
PDF
Docker-v3.pdf
Bruno Cornec
 
PDF
Introduction to Docker
Kuan Yen Heng
 
PDF
Killer Docker Workflows for Development
Chris Tankersley
 
PPTX
Docker and-daily-devops
Satria Ady Pradana
 
PPTX
Docker & Daily DevOps
Satria Ady Pradana
 
PPTX
OpenStack Boston
Docker, Inc.
 
PDF
Docker and OpenStack Boston Meetup
Kamesh Pemmaraju
 
PPTX
Docker open stack boston
dotCloud
 
Docker - Portable Deployment
javaonfly
 
Introduction to Docker
Aditya Konarde
 
Docker Introduction
Jeffrey Ellin
 
Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up
JérÎme Petazzoni
 
ma-formation-en-Docker-jlklk,nknkjn.pptx
imenhamada17
 
Docker 0.11 at MaxCDN meetup in Los Angeles
JérÎme Petazzoni
 
Scale Big With Docker — Moboom 2014
JérÎme Petazzoni
 
Docker introduction
dotCloud
 
Dockerize your Symfony application - Symfony Live NYC 2014
André RÞmcke
 
Intro Docker october 2013
dotCloud
 
Intro to Docker November 2013
Docker, Inc.
 
Docker introduction
Phuc Nguyen
 
Docker-v3.pdf
Bruno Cornec
 
Introduction to Docker
Kuan Yen Heng
 
Killer Docker Workflows for Development
Chris Tankersley
 
Docker and-daily-devops
Satria Ady Pradana
 
Docker & Daily DevOps
Satria Ady Pradana
 
OpenStack Boston
Docker, Inc.
 
Docker and OpenStack Boston Meetup
Kamesh Pemmaraju
 
Docker open stack boston
dotCloud
 
Ad

More from Arun prasath (9)

PDF
Managing Microservices traffic using Istio
Arun prasath
 
ODP
Istio
Arun prasath
 
PPTX
Elk with Openstack
Arun prasath
 
PPTX
Openstack Heat
Arun prasath
 
PPT
HP CloudSystem Matrix
Arun prasath
 
PDF
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
Arun prasath
 
PDF
Highly confidential security system - sole survivors - SRS
Arun prasath
 
PDF
Toll application - .NET and Android - SRS
Arun prasath
 
PPTX
Toll app - Android project
Arun prasath
 
Managing Microservices traffic using Istio
Arun prasath
 
Istio
Arun prasath
 
Elk with Openstack
Arun prasath
 
Openstack Heat
Arun prasath
 
HP CloudSystem Matrix
Arun prasath
 
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
Arun prasath
 
Highly confidential security system - sole survivors - SRS
Arun prasath
 
Toll application - .NET and Android - SRS
Arun prasath
 
Toll app - Android project
Arun prasath
 
Ad

Recently uploaded (20)

PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
Executive Business Intelligence Dashboards
vandeslie24
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 

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