SlideShare uma empresa Scribd logo
1 de 84
Docker for PHP
Developers
Chris Tankersley
@dragonmantank
Pacific Northwest PHP, September 2016
Pacific Northwest PHP, September 2016 1
What Is Docker?
“Docker is an open platform for developers and sysadmins to build,
ship, and run distributed applications. Consisting of Docker Engine, a
portable, lightweight runtime and packaging tool, and Docker Hub, a
cloud service for sharing applications and automating workflows,
Docker enables apps to be quickly assembled from components and
eliminates the friction between development, QA, and production
environments.”
Pacific Northwest PHP, September 2016 2
https://www.docker.com/whatisdocker/
Containers
Pacific Northwest PHP, September 2016 3
Normal Bare-Metal Server
Pacific Northwest PHP, September 2016 4
CPU RAM HD Network
Operating System
nginx PHP DB
Virtual Machines
Pacific Northwest PHP, September 2016 5
CPU RAM HD Network
Operating System
nginx PHP DB
Operating System
nginx PHP DB
Operating System
Hypervisor
Containers
Pacific Northwest PHP, September 2016 6
CPU RAM HD Network
Operating System
nginxnginx PHP DB PHP DB
Containers Are Not New
• LXC (Linux Containers)
• OpenVZ
• Systemd-nspawn
• Qemu/kvm
• BSD Jails
• Solaris Zones
• chroot
Pacific Northwest PHP, September 2016 7
Docker is an Ecosystem
Pacific Northwest PHP, September 2016 8
Docker Engine
Docker is an Ecosystem
Pacific Northwest PHP, September 2016 9
Docker ComposeDocker Machine Docker Swarm
How does it work?
Pacific Northwest PHP, September 2016 10
Uses a variety of existing
Container technologies
Server Containers
Hyper-V Containers xhyve Virtualization
Sorry OSX < 10.10 and Windows < 10 Users
Docker Toolbox
Pacific Northwest PHP, September 2016 11
Let’s use Docker
Pacific Northwest PHP, September 2016 12
Running a container
• `docker run` will run a container
• This will not restart an existing container, just create a new one
• docker run [options] IMAGE [command] [arguments]
• [options ]modify the docker process for this container
• IMAGE is the image to use
• [command] is the command to run inside the container
• [arguments] are arguments for the command
Pacific Northwest PHP, September 2016 13
Running a simple shell
Pacific Northwest PHP, September 2016 14
Running a simple shell
Pacific Northwest PHP, September 2016 15
Running a simple shell
Pacific Northwest PHP, September 2016 16
What’s Going On?
Pacific Northwest PHP, September 2016 17
Ubuntu Kernel
/
+ bin/
+ etc/
+ dev/
+ home/
+ usr/
+ var/
+ lib/
+ …
nginx
bash
/
+ bin/
+ etc/
+ dev/
+ home/
+ usr/
+ var/
+ lib/
+ …
php
Running Two Webservers
Pacific Northwest PHP, September 2016 18
Running Two Webservers
Pacific Northwest PHP, September 2016 19
Running Two Webservers
Pacific Northwest PHP, September 2016 20
Running Two Webservers
Pacific Northwest PHP, September 2016 21
Running Two Webservers
Pacific Northwest PHP, September 2016 22
Running Two Webservers
Pacific Northwest PHP, September 2016 23
Running Two Webservers
Pacific Northwest PHP, September 2016 24
Running Two Webservers
Pacific Northwest PHP, September 2016 25
Some Notes
• All three containers are 100% self contained
• Docker containers share common ancestors, but keep their own files
• `docker run` parameters:
• --rm – Destroy a container once it exits
• -d – Run in the background (daemon mode)
• -i – Run in interactive mode
• --name – Give the container a name
• -p [local port]:[container port] – Forward the local port to the container port
Pacific Northwest PHP, September 2016 26
Volumes
Pacific Northwest PHP, September 2016 27
Modifying a running container
• `docker exec` can run a command inside of an existing container
• Use Volumes to share data
Pacific Northwest PHP, September 2016 28
Persistent Data with Volumes
• You can designate a volume with –v
• Create a named volume with `volume create`
• Volumes can be shared amongst containers
• Volumes can mount data from the host system
Pacific Northwest PHP, September 2016 29
Mounting from the host machine
Pacific Northwest PHP, September 2016 30
Mounting from the host machine
Pacific Northwest PHP, September 2016 31
Mounting from the host machine
Pacific Northwest PHP, September 2016 32
Mounting from the host machine
Pacific Northwest PHP, September 2016 33
Mounting from the host machine
Pacific Northwest PHP, September 2016 34
Mounting from the host isn’t perfect
• The container now has a window into your host machine
• Permissions can get screwy if you are modifying in the container
• Most things it creates will be root by default, and you probably aren’t root on
the host machine
• Host-mounted volumes are not portable at all
• OSX and Hyper-V VMs have limited pathings to mount
• OSX has poor I/O performance
Pacific Northwest PHP, September 2016 35
Named Data Volumes
• Creates a space that becomes persistent
• Can be mounted anywhere inside your images
• Have our app containers use the data volume to store data
• Use ‘editor containers’ to go in and modify data when needed
Pacific Northwest PHP, September 2016 36
Mounting Data Volumes
Pacific Northwest PHP, September 2016 37
Mounting Data Volumes
Pacific Northwest PHP, September 2016 38
Mounting Data Volumes
Pacific Northwest PHP, September 2016 39
Mounting Data Volumes
Pacific Northwest PHP, September 2016 40
Mounting Data Volumes
Pacific Northwest PHP, September 2016 41
Mounting Data Volumes
Pacific Northwest PHP, September 2016 42
Why go through the hassle?
• Data volumes are portable, depending on the driver
• Data volumes are safer
• Separates the app containers from data
• Production can use a data volume, dev can use a host volume
• Our app containers stay small
• Works directly with other tools
Pacific Northwest PHP, September 2016 43
Network Linking
Pacific Northwest PHP, September 2016 44
Docker Links
• Allows containers to ‘see’ each other over the network
• Each container thinks the other one is just another machine
• Containers all have an internal network address, so we don’t need to
expose everything through the host
• Legacy Links work with `--link`
• Can set up virtual networks
Pacific Northwest PHP, September 2016 45
More Traditional Setup
Pacific Northwest PHP, September 2016 46
INTARWEBS Nginx PHP-FPM
Data Volume
Port 9000
Editor
Mounting Data Volumes
Pacific Northwest PHP, September 2016 47
Mounting Data Volumes
Pacific Northwest PHP, September 2016 48
Mounting Data Volumes
Pacific Northwest PHP, September 2016 49
Mounting Data Volumes
Pacific Northwest PHP, September 2016 50
Mounting Data Volumes
Pacific Northwest PHP, September 2016 51
Mounting Data Volumes
Pacific Northwest PHP, September 2016 52
Let’s Build It
Pacific Northwest PHP, September 2016 53
Let’s Build It
Pacific Northwest PHP, September 2016 54
Let’s Build It
Pacific Northwest PHP, September 2016 55
Let’s Build It
Pacific Northwest PHP, September 2016 56
Let’s Build It
Pacific Northwest PHP, September 2016 57
More Notes!
• We can now rebuild sections of the app as needed
• We can restart nginx without impacting PHP
• We can extend much easier
• Docker 1.12 has added a whole bunch of new stuff
Pacific Northwest PHP, September 2016 58
BREAK TIME! WOO!
Pacific Northwest PHP, September 2016 59
Other Helpful Commands
Pacific Northwest PHP, September 2016 60
Inspect a container
docker inspect [options] CONTAINER_NAME
• Returns a JSON string with data about the container
• Can also query
• docker inspect -f “{{ .NetworkSettings.IPAddress }}” web_server
• Really handy for scripting out things like reverse proxies
Pacific Northwest PHP, September 2016 61
Work with images
• docker pull IMAGE – Pulls down an image before using
• docker images – Lists all the images that are downloaded
• docker rmi IMAGE – Deletes an image if it’s not being used
Pacific Northwest PHP, September 2016 62
Our Goals
• Not change our workflow (much)
• Run PHP 7, Unit Tests, and webserver
• Deploy “easily”
Pacific Northwest PHP, September 2016 63
Containerizing Commands
Pacific Northwest PHP, September 2016 64
Running Composer
docker run --rm 
-v c:/Users/drago/.composer:/root/.composer 
-v c:/Users/drago/Projects/workshop:/app 
-v c:/Users/drago/.ssh:/root/.ssh 
composer/composer 
require phpunit/phpunit
Pacific Northwest PHP, September 2016 65
Functions!
function docker-composer() {
appname=$(basename `pwd -P`)
appname="${appname/-/}"
imagename='composer/composer'
output=$(docker images | grep "${appname}_composer")
if [ "$?" = "0" ]; then
imagename="${appname}_composer"
fi
docker run --rm -v ~/.composer:/root/.composer -v
$(pwd):/app -v ~/.ssh:/root/.ssh $imagename $*
}
Pacific Northwest PHP, September 2016 66
Add our code to the autloader
{
"require": {
"phpunit/phpunit": "^5.5"
},
"autoload": {
"psr-4": {
"DemoApp": "src/"
}
}
}
Pacific Northwest PHP, September 2016 67
Run our app
docker run -d --name phptest 
-v c:/Users/drago/Projects/workshop/:/app 
-w /app/html 
-p 8080:80 
php:cli 
php -S 0.0.0.0:80
Pacific Northwest PHP, September 2016 68
Unit Test our Code
docker run --rm -ti 
-v c:/Users/drago/Projects/workshop/:/app
-w /app
php:cli
vendor/bin/phpunit -c phpunit.dist.xml
Pacific Northwest PHP, September 2016 69
Docker Compose
Pacific Northwest PHP, September 2016 70
What is Docker Compose?
• Multi-container orchestration
• A single config file holds all of your container info
• Works with Docker Swarm and a few other tools, like Rancher
Pacific Northwest PHP, September 2016 71
Sample docker-compose.yml
version: ‘2’
volumes:
mysqldata:
driver: local
phpserver:
build: ./docker/php
volumes:
- ./:/var/www/
mysqlserver:
image: mysql
environment:
MYSQL_DATABASE: dockerfordevs
MYSQL_ROOT_PASSWORD: docker
volumes:
- mysqldata:/var/lib/mysql
nginx:
build: ./docker/nginx
ports:
- "80:80"
- "443:443"
Pacific Northwest PHP, September 2016 72
Creating your own Images
Pacific Northwest PHP, September 2016 73
Dockerfile
• Dockerfile is the configuration steps for an image
• Can be created from scratch, or based on another image
• Allows you to add files, create default volumes, ports, etc
• Can be used privately or pushed to Docker Hub
Pacific Northwest PHP, September 2016 74
FROM php:7
RUN apt-get update 
&& apt-get install –y 
libmcrypt-dev 
libpng12-dev 
libfreetype6-dev 
libjpeg62-turbo-dev 
&& docker-php-ext-install iconv mcrypt pdo pdo_mysql
COPY build/app /var/www
# …
EXPOSE 80 443
VOLUME /var/www
VOLUME /var/log
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Pacific Northwest PHP, September 2016 75
Build it
docker build -t tag_name ./
• This runs through the Dockerfile and generates the image
• We can now use the tag name to run the image
Pacific Northwest PHP, September 2016 76
Add in some Compose
Pacific Northwest PHP, September 2016 77
Start the app with Compose
Pacific Northwest PHP, September 2016 78
Docker Machine
Pacific Northwest PHP, September 2016 79
What is Docker Machine?
• A provisioning tool that is used to set up a box with Docker
• Used in Docker Toolbox to create the VM
• Supports:
• EC2
• Azure
• Digital Ocean
• Hyper-V
• OpenStack
• Virtualbox
• VMWare
Pacific Northwest PHP, September 2016 80
Why use it?
• Makes it very easy to spin up new boxes
• Docker Machine handles all of the dirty stuff for you
• Docker Toolbox users are already using it
• Integrates with Docker Swarm
• It is not necessarily portable
Pacific Northwest PHP, September 2016 81
Let’s make a machine!
Pacific Northwest PHP, September 2016 82
Let’s Connect!
Pacific Northwest PHP, September 2016 83
Thank You!
• https://github.com/dragonmantank
• Author of “Docker for Developers”
• https://leanpub.com/dockerfordevs
• http://ctankersley.com
• chris@ctankersley.com
• @dragonmantank
Pacific Northwest PHP, September 2016 84

Mais conteúdo relacionado

Mais procurados

DevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and WebminDevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and Webminpostrational
 
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...Jean Baptiste Favre
 
The Integration of Laravel with Swoole
The Integration of Laravel with SwooleThe Integration of Laravel with Swoole
The Integration of Laravel with SwooleAlbert Chen
 
perlcc made easy or, how to make a CGI Moose app
perlcc made easy or, how to make a CGI Moose appperlcc made easy or, how to make a CGI Moose app
perlcc made easy or, how to make a CGI Moose appcPanel
 
Paris Monitoring meetup #1 - Zabbix at BlaBlaCar
Paris Monitoring meetup #1 - Zabbix at BlaBlaCarParis Monitoring meetup #1 - Zabbix at BlaBlaCar
Paris Monitoring meetup #1 - Zabbix at BlaBlaCarJean Baptiste Favre
 
Apache Camel workshop at BarcelonaJUG in January 2014
Apache Camel workshop at BarcelonaJUG in January 2014Apache Camel workshop at BarcelonaJUG in January 2014
Apache Camel workshop at BarcelonaJUG in January 2014Claus Ibsen
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011Bachkoutou Toutou
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty FrameworkOpenRestyCon
 
Zend Expressive in 15 Minutes
Zend Expressive in 15 MinutesZend Expressive in 15 Minutes
Zend Expressive in 15 MinutesChris Tankersley
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matterTomas Doran
 
Managing Complexity with Module::Release
Managing Complexity with Module::ReleaseManaging Complexity with Module::Release
Managing Complexity with Module::Releasebrian d foy
 
Getting Started with Apache Camel - Malmo JUG - March 2013
Getting Started with Apache Camel - Malmo JUG - March 2013Getting Started with Apache Camel - Malmo JUG - March 2013
Getting Started with Apache Camel - Malmo JUG - March 2013Claus Ibsen
 
meetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypesmeetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypesMax Małecki
 
Microservices with Apache Camel
Microservices with Apache CamelMicroservices with Apache Camel
Microservices with Apache CamelClaus Ibsen
 
meet.php #11 - Huston, we have an airbrake
meet.php #11 - Huston, we have an airbrakemeet.php #11 - Huston, we have an airbrake
meet.php #11 - Huston, we have an airbrakeMax Małecki
 
Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Claus Ibsen
 
High Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningHigh Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningAlbert Chen
 

Mais procurados (20)

CPAN Training
CPAN TrainingCPAN Training
CPAN Training
 
DevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and WebminDevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and Webmin
 
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
 
The Integration of Laravel with Swoole
The Integration of Laravel with SwooleThe Integration of Laravel with Swoole
The Integration of Laravel with Swoole
 
perlcc made easy or, how to make a CGI Moose app
perlcc made easy or, how to make a CGI Moose appperlcc made easy or, how to make a CGI Moose app
perlcc made easy or, how to make a CGI Moose app
 
The problem with Perl
The problem with PerlThe problem with Perl
The problem with Perl
 
Paris Monitoring meetup #1 - Zabbix at BlaBlaCar
Paris Monitoring meetup #1 - Zabbix at BlaBlaCarParis Monitoring meetup #1 - Zabbix at BlaBlaCar
Paris Monitoring meetup #1 - Zabbix at BlaBlaCar
 
Apache Camel workshop at BarcelonaJUG in January 2014
Apache Camel workshop at BarcelonaJUG in January 2014Apache Camel workshop at BarcelonaJUG in January 2014
Apache Camel workshop at BarcelonaJUG in January 2014
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty Framework
 
Zend Expressive in 15 Minutes
Zend Expressive in 15 MinutesZend Expressive in 15 Minutes
Zend Expressive in 15 Minutes
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matter
 
Managing Complexity with Module::Release
Managing Complexity with Module::ReleaseManaging Complexity with Module::Release
Managing Complexity with Module::Release
 
Getting Started with Apache Camel - Malmo JUG - March 2013
Getting Started with Apache Camel - Malmo JUG - March 2013Getting Started with Apache Camel - Malmo JUG - March 2013
Getting Started with Apache Camel - Malmo JUG - March 2013
 
meetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypesmeetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypes
 
Microservices with Apache Camel
Microservices with Apache CamelMicroservices with Apache Camel
Microservices with Apache Camel
 
meet.php #11 - Huston, we have an airbrake
meet.php #11 - Huston, we have an airbrakemeet.php #11 - Huston, we have an airbrake
meet.php #11 - Huston, we have an airbrake
 
Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013
 
High Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningHigh Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance Tuning
 

Destaque

2013 Social Admissions Report
 2013 Social Admissions Report   2013 Social Admissions Report
2013 Social Admissions Report Uversity, Inc.
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use caserjsmelo
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting StartedWildan Maulana
 
Information Design Web Planning Mockup
Information Design Web Planning MockupInformation Design Web Planning Mockup
Information Design Web Planning MockupANGELA Smithers
 
NTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in RussiaNTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in RussiaOlessya
 
Computer-free Website Development Demo - WordPressDC Jan 2015
 Computer-free Website Development Demo - WordPressDC Jan 2015 Computer-free Website Development Demo - WordPressDC Jan 2015
Computer-free Website Development Demo - WordPressDC Jan 2015Anthony D. Paul
 
Php development with Docker
Php development with DockerPhp development with Docker
Php development with DockerMichael Bui
 
Engine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialistsEngine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialistsJohn Rowan
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Chris Tankersley
 
Microservices without Servers
Microservices without ServersMicroservices without Servers
Microservices without ServersDev_Events
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
component based softwrae engineering Cbse
component based softwrae engineering Cbsecomponent based softwrae engineering Cbse
component based softwrae engineering CbseSravs Dals
 
Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices Dev_Events
 
The App Evolution
The App Evolution The App Evolution
The App Evolution Dev_Events
 
An introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developersAn introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developersRobert McFrazier
 
Documenting software architecture
Documenting software architectureDocumenting software architecture
Documenting software architectureHimanshu
 

Destaque (20)

2013 Social Admissions Report
 2013 Social Admissions Report   2013 Social Admissions Report
2013 Social Admissions Report
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use case
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Information Design Web Planning Mockup
Information Design Web Planning MockupInformation Design Web Planning Mockup
Information Design Web Planning Mockup
 
Spm file33
Spm file33Spm file33
Spm file33
 
NTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in RussiaNTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in Russia
 
Especialidade de inclusão 5
Especialidade de inclusão 5Especialidade de inclusão 5
Especialidade de inclusão 5
 
Computer-free Website Development Demo - WordPressDC Jan 2015
 Computer-free Website Development Demo - WordPressDC Jan 2015 Computer-free Website Development Demo - WordPressDC Jan 2015
Computer-free Website Development Demo - WordPressDC Jan 2015
 
Php development with Docker
Php development with DockerPhp development with Docker
Php development with Docker
 
Engine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialistsEngine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialists
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
 
Microservices without Servers
Microservices without ServersMicroservices without Servers
Microservices without Servers
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
MockupBuilder
MockupBuilderMockupBuilder
MockupBuilder
 
component based softwrae engineering Cbse
component based softwrae engineering Cbsecomponent based softwrae engineering Cbse
component based softwrae engineering Cbse
 
Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices
 
The App Evolution
The App Evolution The App Evolution
The App Evolution
 
An introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developersAn introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developers
 
Lab docker
Lab dockerLab docker
Lab docker
 
Documenting software architecture
Documenting software architectureDocumenting software architecture
Documenting software architecture
 

Semelhante a Docker for PHP Developers

Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsChris Tankersley
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPChris Tankersley
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Chris Tankersley
 
Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)Chris Tankersley
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016Chris Tankersley
 
Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Chris Tankersley
 
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Chris Tankersley
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
 
Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Chris Tankersley
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuis Rodríguez Castromil
 
23 LAMP Stack #burningkeyboards
23 LAMP Stack #burningkeyboards23 LAMP Stack #burningkeyboards
23 LAMP Stack #burningkeyboardsDenis Ristic
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta Vinnakota
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with dockerMaciej Lukianski
 
DevOps, CLI, APIs, Oh My! Security Gone Agile
DevOps, CLI, APIs, Oh My!  Security Gone AgileDevOps, CLI, APIs, Oh My!  Security Gone Agile
DevOps, CLI, APIs, Oh My! Security Gone AgileMatt Tesauro
 
NYC Identity Summit Tech Day: ForgeRock DevOps/Cloud Strategy
NYC Identity Summit Tech Day: ForgeRock DevOps/Cloud StrategyNYC Identity Summit Tech Day: ForgeRock DevOps/Cloud Strategy
NYC Identity Summit Tech Day: ForgeRock DevOps/Cloud StrategyForgeRock
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & howdotCloud
 

Semelhante a Docker for PHP Developers (20)

Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - Jetbrains
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016
 
Dockerize All The Things
Dockerize All The ThingsDockerize All The Things
Dockerize All The Things
 
Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
 
23 LAMP Stack #burningkeyboards
23 LAMP Stack #burningkeyboards23 LAMP Stack #burningkeyboards
23 LAMP Stack #burningkeyboards
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
 
DevOps, CLI, APIs, Oh My! Security Gone Agile
DevOps, CLI, APIs, Oh My!  Security Gone AgileDevOps, CLI, APIs, Oh My!  Security Gone Agile
DevOps, CLI, APIs, Oh My! Security Gone Agile
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
NYC Identity Summit Tech Day: ForgeRock DevOps/Cloud Strategy
NYC Identity Summit Tech Day: ForgeRock DevOps/Cloud StrategyNYC Identity Summit Tech Day: ForgeRock DevOps/Cloud Strategy
NYC Identity Summit Tech Day: ForgeRock DevOps/Cloud Strategy
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 

Mais de Chris Tankersley

Docker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersDocker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersChris Tankersley
 
Bend time to your will with git
Bend time to your will with gitBend time to your will with git
Bend time to your will with gitChris Tankersley
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Chris Tankersley
 
Dead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIDead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIChris Tankersley
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for DevelopmentChris Tankersley
 
BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018Chris Tankersley
 
You Were Lied To About Optimization
You Were Lied To About OptimizationYou Were Lied To About Optimization
You Were Lied To About OptimizationChris Tankersley
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Chris Tankersley
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017Chris Tankersley
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017Chris Tankersley
 
Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Chris Tankersley
 
How We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceHow We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceChris Tankersley
 
Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016Chris Tankersley
 
A Brief History of Open Source
A Brief History of Open SourceA Brief History of Open Source
A Brief History of Open SourceChris Tankersley
 
Deploying Containers with Rancher
Deploying Containers with RancherDeploying Containers with Rancher
Deploying Containers with RancherChris Tankersley
 

Mais de Chris Tankersley (19)

Docker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersDocker is Dead: Long Live Containers
Docker is Dead: Long Live Containers
 
Bend time to your will with git
Bend time to your will with gitBend time to your will with git
Bend time to your will with git
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)
 
Dead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIDead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPI
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
You Got Async in my PHP!
You Got Async in my PHP!You Got Async in my PHP!
You Got Async in my PHP!
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
They are Watching You
They are Watching YouThey are Watching You
They are Watching You
 
BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018
 
You Were Lied To About Optimization
You Were Lied To About OptimizationYou Were Lied To About Optimization
You Were Lied To About Optimization
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
 
Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016
 
How We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceHow We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open Source
 
Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016
 
A Brief History of Open Source
A Brief History of Open SourceA Brief History of Open Source
A Brief History of Open Source
 
Deploying Containers with Rancher
Deploying Containers with RancherDeploying Containers with Rancher
Deploying Containers with Rancher
 
WTF Is Rancher?
WTF Is Rancher?WTF Is Rancher?
WTF Is Rancher?
 

Último

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Último (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Docker for PHP Developers

  • 1. Docker for PHP Developers Chris Tankersley @dragonmantank Pacific Northwest PHP, September 2016 Pacific Northwest PHP, September 2016 1
  • 2. What Is Docker? “Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. Consisting of Docker Engine, a portable, lightweight runtime and packaging tool, and Docker Hub, a cloud service for sharing applications and automating workflows, Docker enables apps to be quickly assembled from components and eliminates the friction between development, QA, and production environments.” Pacific Northwest PHP, September 2016 2 https://www.docker.com/whatisdocker/
  • 4. Normal Bare-Metal Server Pacific Northwest PHP, September 2016 4 CPU RAM HD Network Operating System nginx PHP DB
  • 5. Virtual Machines Pacific Northwest PHP, September 2016 5 CPU RAM HD Network Operating System nginx PHP DB Operating System nginx PHP DB Operating System Hypervisor
  • 6. Containers Pacific Northwest PHP, September 2016 6 CPU RAM HD Network Operating System nginxnginx PHP DB PHP DB
  • 7. Containers Are Not New • LXC (Linux Containers) • OpenVZ • Systemd-nspawn • Qemu/kvm • BSD Jails • Solaris Zones • chroot Pacific Northwest PHP, September 2016 7
  • 8. Docker is an Ecosystem Pacific Northwest PHP, September 2016 8 Docker Engine
  • 9. Docker is an Ecosystem Pacific Northwest PHP, September 2016 9 Docker ComposeDocker Machine Docker Swarm
  • 10. How does it work? Pacific Northwest PHP, September 2016 10 Uses a variety of existing Container technologies Server Containers Hyper-V Containers xhyve Virtualization
  • 11. Sorry OSX < 10.10 and Windows < 10 Users Docker Toolbox Pacific Northwest PHP, September 2016 11
  • 12. Let’s use Docker Pacific Northwest PHP, September 2016 12
  • 13. Running a container • `docker run` will run a container • This will not restart an existing container, just create a new one • docker run [options] IMAGE [command] [arguments] • [options ]modify the docker process for this container • IMAGE is the image to use • [command] is the command to run inside the container • [arguments] are arguments for the command Pacific Northwest PHP, September 2016 13
  • 14. Running a simple shell Pacific Northwest PHP, September 2016 14
  • 15. Running a simple shell Pacific Northwest PHP, September 2016 15
  • 16. Running a simple shell Pacific Northwest PHP, September 2016 16
  • 17. What’s Going On? Pacific Northwest PHP, September 2016 17 Ubuntu Kernel / + bin/ + etc/ + dev/ + home/ + usr/ + var/ + lib/ + … nginx bash / + bin/ + etc/ + dev/ + home/ + usr/ + var/ + lib/ + … php
  • 18. Running Two Webservers Pacific Northwest PHP, September 2016 18
  • 19. Running Two Webservers Pacific Northwest PHP, September 2016 19
  • 20. Running Two Webservers Pacific Northwest PHP, September 2016 20
  • 21. Running Two Webservers Pacific Northwest PHP, September 2016 21
  • 22. Running Two Webservers Pacific Northwest PHP, September 2016 22
  • 23. Running Two Webservers Pacific Northwest PHP, September 2016 23
  • 24. Running Two Webservers Pacific Northwest PHP, September 2016 24
  • 25. Running Two Webservers Pacific Northwest PHP, September 2016 25
  • 26. Some Notes • All three containers are 100% self contained • Docker containers share common ancestors, but keep their own files • `docker run` parameters: • --rm – Destroy a container once it exits • -d – Run in the background (daemon mode) • -i – Run in interactive mode • --name – Give the container a name • -p [local port]:[container port] – Forward the local port to the container port Pacific Northwest PHP, September 2016 26
  • 27. Volumes Pacific Northwest PHP, September 2016 27
  • 28. Modifying a running container • `docker exec` can run a command inside of an existing container • Use Volumes to share data Pacific Northwest PHP, September 2016 28
  • 29. Persistent Data with Volumes • You can designate a volume with –v • Create a named volume with `volume create` • Volumes can be shared amongst containers • Volumes can mount data from the host system Pacific Northwest PHP, September 2016 29
  • 30. Mounting from the host machine Pacific Northwest PHP, September 2016 30
  • 31. Mounting from the host machine Pacific Northwest PHP, September 2016 31
  • 32. Mounting from the host machine Pacific Northwest PHP, September 2016 32
  • 33. Mounting from the host machine Pacific Northwest PHP, September 2016 33
  • 34. Mounting from the host machine Pacific Northwest PHP, September 2016 34
  • 35. Mounting from the host isn’t perfect • The container now has a window into your host machine • Permissions can get screwy if you are modifying in the container • Most things it creates will be root by default, and you probably aren’t root on the host machine • Host-mounted volumes are not portable at all • OSX and Hyper-V VMs have limited pathings to mount • OSX has poor I/O performance Pacific Northwest PHP, September 2016 35
  • 36. Named Data Volumes • Creates a space that becomes persistent • Can be mounted anywhere inside your images • Have our app containers use the data volume to store data • Use ‘editor containers’ to go in and modify data when needed Pacific Northwest PHP, September 2016 36
  • 37. Mounting Data Volumes Pacific Northwest PHP, September 2016 37
  • 38. Mounting Data Volumes Pacific Northwest PHP, September 2016 38
  • 39. Mounting Data Volumes Pacific Northwest PHP, September 2016 39
  • 40. Mounting Data Volumes Pacific Northwest PHP, September 2016 40
  • 41. Mounting Data Volumes Pacific Northwest PHP, September 2016 41
  • 42. Mounting Data Volumes Pacific Northwest PHP, September 2016 42
  • 43. Why go through the hassle? • Data volumes are portable, depending on the driver • Data volumes are safer • Separates the app containers from data • Production can use a data volume, dev can use a host volume • Our app containers stay small • Works directly with other tools Pacific Northwest PHP, September 2016 43
  • 44. Network Linking Pacific Northwest PHP, September 2016 44
  • 45. Docker Links • Allows containers to ‘see’ each other over the network • Each container thinks the other one is just another machine • Containers all have an internal network address, so we don’t need to expose everything through the host • Legacy Links work with `--link` • Can set up virtual networks Pacific Northwest PHP, September 2016 45
  • 46. More Traditional Setup Pacific Northwest PHP, September 2016 46 INTARWEBS Nginx PHP-FPM Data Volume Port 9000 Editor
  • 47. Mounting Data Volumes Pacific Northwest PHP, September 2016 47
  • 48. Mounting Data Volumes Pacific Northwest PHP, September 2016 48
  • 49. Mounting Data Volumes Pacific Northwest PHP, September 2016 49
  • 50. Mounting Data Volumes Pacific Northwest PHP, September 2016 50
  • 51. Mounting Data Volumes Pacific Northwest PHP, September 2016 51
  • 52. Mounting Data Volumes Pacific Northwest PHP, September 2016 52
  • 53. Let’s Build It Pacific Northwest PHP, September 2016 53
  • 54. Let’s Build It Pacific Northwest PHP, September 2016 54
  • 55. Let’s Build It Pacific Northwest PHP, September 2016 55
  • 56. Let’s Build It Pacific Northwest PHP, September 2016 56
  • 57. Let’s Build It Pacific Northwest PHP, September 2016 57
  • 58. More Notes! • We can now rebuild sections of the app as needed • We can restart nginx without impacting PHP • We can extend much easier • Docker 1.12 has added a whole bunch of new stuff Pacific Northwest PHP, September 2016 58
  • 59. BREAK TIME! WOO! Pacific Northwest PHP, September 2016 59
  • 60. Other Helpful Commands Pacific Northwest PHP, September 2016 60
  • 61. Inspect a container docker inspect [options] CONTAINER_NAME • Returns a JSON string with data about the container • Can also query • docker inspect -f “{{ .NetworkSettings.IPAddress }}” web_server • Really handy for scripting out things like reverse proxies Pacific Northwest PHP, September 2016 61
  • 62. Work with images • docker pull IMAGE – Pulls down an image before using • docker images – Lists all the images that are downloaded • docker rmi IMAGE – Deletes an image if it’s not being used Pacific Northwest PHP, September 2016 62
  • 63. Our Goals • Not change our workflow (much) • Run PHP 7, Unit Tests, and webserver • Deploy “easily” Pacific Northwest PHP, September 2016 63
  • 65. Running Composer docker run --rm -v c:/Users/drago/.composer:/root/.composer -v c:/Users/drago/Projects/workshop:/app -v c:/Users/drago/.ssh:/root/.ssh composer/composer require phpunit/phpunit Pacific Northwest PHP, September 2016 65
  • 66. Functions! function docker-composer() { appname=$(basename `pwd -P`) appname="${appname/-/}" imagename='composer/composer' output=$(docker images | grep "${appname}_composer") if [ "$?" = "0" ]; then imagename="${appname}_composer" fi docker run --rm -v ~/.composer:/root/.composer -v $(pwd):/app -v ~/.ssh:/root/.ssh $imagename $* } Pacific Northwest PHP, September 2016 66
  • 67. Add our code to the autloader { "require": { "phpunit/phpunit": "^5.5" }, "autoload": { "psr-4": { "DemoApp": "src/" } } } Pacific Northwest PHP, September 2016 67
  • 68. Run our app docker run -d --name phptest -v c:/Users/drago/Projects/workshop/:/app -w /app/html -p 8080:80 php:cli php -S 0.0.0.0:80 Pacific Northwest PHP, September 2016 68
  • 69. Unit Test our Code docker run --rm -ti -v c:/Users/drago/Projects/workshop/:/app -w /app php:cli vendor/bin/phpunit -c phpunit.dist.xml Pacific Northwest PHP, September 2016 69
  • 70. Docker Compose Pacific Northwest PHP, September 2016 70
  • 71. What is Docker Compose? • Multi-container orchestration • A single config file holds all of your container info • Works with Docker Swarm and a few other tools, like Rancher Pacific Northwest PHP, September 2016 71
  • 72. Sample docker-compose.yml version: ‘2’ volumes: mysqldata: driver: local phpserver: build: ./docker/php volumes: - ./:/var/www/ mysqlserver: image: mysql environment: MYSQL_DATABASE: dockerfordevs MYSQL_ROOT_PASSWORD: docker volumes: - mysqldata:/var/lib/mysql nginx: build: ./docker/nginx ports: - "80:80" - "443:443" Pacific Northwest PHP, September 2016 72
  • 73. Creating your own Images Pacific Northwest PHP, September 2016 73
  • 74. Dockerfile • Dockerfile is the configuration steps for an image • Can be created from scratch, or based on another image • Allows you to add files, create default volumes, ports, etc • Can be used privately or pushed to Docker Hub Pacific Northwest PHP, September 2016 74
  • 75. FROM php:7 RUN apt-get update && apt-get install –y libmcrypt-dev libpng12-dev libfreetype6-dev libjpeg62-turbo-dev && docker-php-ext-install iconv mcrypt pdo pdo_mysql COPY build/app /var/www # … EXPOSE 80 443 VOLUME /var/www VOLUME /var/log RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* Pacific Northwest PHP, September 2016 75
  • 76. Build it docker build -t tag_name ./ • This runs through the Dockerfile and generates the image • We can now use the tag name to run the image Pacific Northwest PHP, September 2016 76
  • 77. Add in some Compose Pacific Northwest PHP, September 2016 77
  • 78. Start the app with Compose Pacific Northwest PHP, September 2016 78
  • 79. Docker Machine Pacific Northwest PHP, September 2016 79
  • 80. What is Docker Machine? • A provisioning tool that is used to set up a box with Docker • Used in Docker Toolbox to create the VM • Supports: • EC2 • Azure • Digital Ocean • Hyper-V • OpenStack • Virtualbox • VMWare Pacific Northwest PHP, September 2016 80
  • 81. Why use it? • Makes it very easy to spin up new boxes • Docker Machine handles all of the dirty stuff for you • Docker Toolbox users are already using it • Integrates with Docker Swarm • It is not necessarily portable Pacific Northwest PHP, September 2016 81
  • 82. Let’s make a machine! Pacific Northwest PHP, September 2016 82
  • 83. Let’s Connect! Pacific Northwest PHP, September 2016 83
  • 84. Thank You! • https://github.com/dragonmantank • Author of “Docker for Developers” • https://leanpub.com/dockerfordevs • http://ctankersley.com • chris@ctankersley.com • @dragonmantank Pacific Northwest PHP, September 2016 84