DOCKERINTRODUCTION TO CONTAINERS FOR
PHP DEVELOPERS
DOCKER - INTRODUCTION FOR PHP DEVELOPERS
MICHAŁ KURZEJA
▸ CTO at accesto.com
▸ michal@accesto.com
▸ @michalKurzeja
▸ Homebrewer
▸ Swimmer/runner
Docker - introduction
WHY
DOCKER?
Docker - introduction
DOCKER
SYSTEM DEPENDENCIES
DOCKER
SYSTEM DEPENDENCIES
PROJECT 1
PROJECT 2
PROJECT 3
* M
DOCKER
SYSTEM DEPENDENCIES
Developer 1
Tester
Developer 2
CI
Staging
* N
DOCKER - INTRODUCTION FOR PHP DEVELOPERS
PROJECT DEPENDENCY MATRIX FROM HELL
Dev Stage Prod CI
PHP ? ? ? ?
MySQL ? ? ? ?
Redis ? ? ? ?
RabbitMQ ? ? ? ?
Neo4j ? ? ? ?
Hadoop/
Spark
? ? ? ?
DOCKER - INTRODUCTION FOR PHP DEVELOPERS
PROJECT DEPENDENCY MATRIX FROM HELL
Dev Stage Prod CI
PHP ? ?
MySQL ? ? ?
Redis ? ? ? ?
RabbitMQ ? ? ? ?
Neo4j ? ? ? ?
Hadoop/
Spark
? ? ? ?
PROFITS?
BUILD ONCE,
EXECUTE
EVERYWHERE*
NO DEPENDENCY
& NO INCOMPATIBILITY
ISSUES
VM WITHOUT
OVERHEAD
FULLY
AUTOMATED
EASY
TO DEPLOY
SEPARATION
OF DUTIES
SCALABILITY
TECHNICAL
BACKGROUND
TEKST
VIRTUAL MACHINES VS CONTAINERS
TEKST
WHY IS DOCKER FAST?
IMAGE
IMAGE LAYER
imagelayers.io
CONTAINER
REPOSITORY
DOCKER HUB
DEMO TIME!
docker run docker/whalesay cowsay PHP!
docker run docker/whalesay cowsay PHP!
docker run docker/whalesay cowsay PHP!
docker run docker/whalesay cowsay PHP!
Docker - introduction
docker run -v $PWD:/var/www/html 

-p 8081:80 

php:5.6-apache
docker run -v $PWD:/var/www/html 

-p 8081:80 

php:5.6-apache
docker run -v $PWD:/var/www/html 

-p 8081:80 

php:5.6-apache 7.0-apache
Docker - introduction
Docker - introduction
READY TO
DIVE DEEPER?
OWN
DOCKER IMAGE
FROM docker/whalesay:latest
Dockerfile
FROM docker/whalesay:latest

RUN apt-get -y update && apt-get install -y fortunes
Dockerfile
FROM docker/whalesay:latest

RUN apt-get -y update && apt-get install -y fortunes

CMD /usr/games/fortune -a | cowsay
Dockerfile
FROM docker/whalesay:latest

RUN apt-get -y update && apt-get install -y fortunes

CMD /usr/games/fortune -a | cowsay
docker build -t docker-whale .
Dockerfile
FROM docker/whalesay:latest

RUN apt-get -y update && apt-get install -y fortunes

CMD /usr/games/fortune -a | cowsay
docker build -t docker-whale .
Dockerfile
FROM docker/whalesay:latest

RUN apt-get -y update && apt-get install -y fortunes

CMD /usr/games/fortune -a | cowsay
docker build -t docker-whale .



docker run docker-whale
Dockerfile
Docker - introduction
Docker - introduction
Docker - introduction
Docker - introduction
EVERYTHING IN ONE CONTAINER ?
MULTIPLE CONTAINERS!
DOCKER
COMPOSE
docker run -v $PWD/www:/var/www/html 

-p 8081:80 

php:7.0-apache
docker run -v $PWD/www:/var/www/html 

-p 8081:80 

php:7.0-apacheX
#docker-compose.yml
www:

image: php:7.0-apache
docker run -v $PWD/www:/var/www/html 

-p 8081:80 

php:7.0-apache
#docker-compose.yml
www:

image: php:7.0-apache

volumes: 

- ./www:/var/www/html

docker run -v $PWD/www:/var/www/html 

-p 8081:80 

php:7.0-apache
#docker-compose.yml
www:

image: php:7.0-apache

volumes: 

- ./www:/var/www/html

ports:

- 8081:80
docker run -v $PWD/www:/var/www/html 

-p 8081:80 

php:7.0-apache
#docker-compose.yml
www:

image: php:7.0-apache

volumes: 

- ./www:/var/www/html

ports:

- 8081:80
docker-compose up
Docker - introduction
LINKING
CONTAINERS
WWW REDIS
www:

image: php:7.0-apache

volumes: 

- ./www:/var/www/html

ports:

- 8081:80



redis:

image: redis
www:

image: php:7.0-apache

volumes: 

- ./www:/var/www/html

ports:

- 8081:80

links:

- redis

redis:

image: redis
<?php
/* www/index.php */
require_once __DIR__.'/vendor/autoload.php';
$client = new PredisClient(['host' => 'redis']);
$counter = $client->incr('counter');
echo "Hostname: ".gethostname().PHP_EOL;
echo " Counter: ".$counter.PHP_EOL;
docker-compose ps
SCALING
APPLICATIONS
WWW REDIS
WWW
WWW
…
HAPROXY
version: '2'

services:

www:

image: php:7.0-apache

volumes: 

- ./www:/var/www/html

ports:

- 8081:80

links:

- redis

redis:

image: redis
version: '2'

services:

www: …

haproxy:

image: 'dockercloud/haproxy:latest'

redis: …
version: '2'

services:

www: …

haproxy:

image: 'dockercloud/haproxy:latest'

links:

- www

redis: …
version: '2'

services:

www: …

haproxy:

image: 'dockercloud/haproxy:latest'

links:

- www

ports:

- '80:80'

redis: …
version: '2'

services:

www: …

haproxy:

image: 'dockercloud/haproxy:latest'

links:

- www

ports:

- '80:80'

environment:

- DOCKER_TLS_VERIFY

- DOCKER_HOST

- DOCKER_CERT_PATH

volumes:

- $DOCKER_CERT_PATH:$DOCKER_CERT_PATH

redis: …
docker-compose up -d
docker-compose scale www=3
docker-compose ps
Docker - introduction
DEEPER?
DOCKER SWARM
MESOSPHERE
KUBERNETES
DOCKER
PACKAGING OWN APPLICATIONS
▸ Use Dockerfile
▸ COPY project code
▸ Orchestrate [with compose]
▸ Split into multiple containers
DOCKER
DEPLOYMENT TIPS&TRICKS
▸ Own in-house docker repository
▸ No direct disk usage
▸ Gaufrette - filesystem abstraction
▸ Logstash - logs
▸ Session in redis/memcached
CHALLENGE
ACCEPTED?
QUESTIONS?

More Related Content

PDF
Docker Introduction
PDF
Docker workshop
PDF
Docker Introduction + what is new in 0.9
PDF
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
PDF
Orchestrating Docker containers at scale
PPTX
Architecting .NET Applications for Docker and Container Based Deployments
PDF
PDF
Docker Introduction
Docker Introduction
Docker workshop
Docker Introduction + what is new in 0.9
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Orchestrating Docker containers at scale
Architecting .NET Applications for Docker and Container Based Deployments
Docker Introduction

What's hot (20)

ODP
Docker - The Linux Container
ODP
Why Docker? Dayton PHP, April 2017
PDF
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
PDF
Wordcamp Bratislava 2017 - Docker! Why?
PDF
Docker Introduction
PDF
Visualising Basic Concepts of Docker
PPTX
Introduction to Docker
PDF
Docker introduction
PPT
Docker introduction
PDF
Introduction to Docker
PDF
Developer workflow with docker
PDF
Learning Docker with Thomas
PDF
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
PDF
Basic docker for developer
PPTX
Docker - 15 great Tutorials
PDF
Docker and the Linux Kernel
PDF
Intro to containerization
ODP
Ruby and Docker on Rails
PDF
Docker 101 @KACST Saudi HPC 2016
PDF
Shipping Applications to Production in Containers with Docker
Docker - The Linux Container
Why Docker? Dayton PHP, April 2017
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Wordcamp Bratislava 2017 - Docker! Why?
Docker Introduction
Visualising Basic Concepts of Docker
Introduction to Docker
Docker introduction
Docker introduction
Introduction to Docker
Developer workflow with docker
Learning Docker with Thomas
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Basic docker for developer
Docker - 15 great Tutorials
Docker and the Linux Kernel
Intro to containerization
Ruby and Docker on Rails
Docker 101 @KACST Saudi HPC 2016
Shipping Applications to Production in Containers with Docker
Ad

Viewers also liked (20)

PDF
From development environments to production deployments with Docker, Compose,...
PDF
A Gentle Introduction To Docker And All Things Containers
PDF
Docker by Example - Basics
PPTX
Docker introduction
PPTX
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
PDF
How to deploy PHP projects with docker
PPTX
Docker Demystified - Virtual VMs without the Fat
PPTX
Working with kubernetes
PDF
Docker from basics to orchestration (PHPConfBr2015)
KEY
PDF
Oracle rac cachefusion - High Availability Day 2015
PPTX
Dockerize it all
PDF
Cloud conference - mongodb
PDF
Aman sharma hyd_12crac High Availability Day 2015
PPTX
Docker containers
PDF
RACATTACK Lab Handbook - Enable Flex Cluster and Flex ASM
PPTX
Kubernetes Basics
PDF
Docker Intro
PDF
Spark Application for Time Series Analysis
PDF
Flex Your Database on 12c's Flex ASM and Flex Cluster
From development environments to production deployments with Docker, Compose,...
A Gentle Introduction To Docker And All Things Containers
Docker by Example - Basics
Docker introduction
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
How to deploy PHP projects with docker
Docker Demystified - Virtual VMs without the Fat
Working with kubernetes
Docker from basics to orchestration (PHPConfBr2015)
Oracle rac cachefusion - High Availability Day 2015
Dockerize it all
Cloud conference - mongodb
Aman sharma hyd_12crac High Availability Day 2015
Docker containers
RACATTACK Lab Handbook - Enable Flex Cluster and Flex ASM
Kubernetes Basics
Docker Intro
Spark Application for Time Series Analysis
Flex Your Database on 12c's Flex ASM and Flex Cluster
Ad

Similar to Docker - introduction (20)

PDF
Dockerize your Symfony application - Symfony Live NYC 2014
PPTX
Docker for dev
PDF
Introduction to Docker
PPTX
Primi passi con Docker - ItalianCoders - 12-01-2021
PDF
Docker Introduction.pdf
PPTX
PDF
Play With Docker
PPTX
Docker for the new Era: Introducing Docker,its components and tools
PDF
Drupal Development with Docker
PPTX
Docker introduction
PDF
Nodejs OC Docker and Node
PPTX
Docker Starter Pack
PDF
Killer Docker Workflows for Development
PDF
Docker how to
PDF
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
PDF
Agile Brown Bag - Vagrant & Docker: Introduction
PDF
Developing and Deploying PHP with Docker
PPTX
Docker for Web Developers: A Sneak Peek
PDF
Docker for developers
PDF
Docker for developers
Dockerize your Symfony application - Symfony Live NYC 2014
Docker for dev
Introduction to Docker
Primi passi con Docker - ItalianCoders - 12-01-2021
Docker Introduction.pdf
Play With Docker
Docker for the new Era: Introducing Docker,its components and tools
Drupal Development with Docker
Docker introduction
Nodejs OC Docker and Node
Docker Starter Pack
Killer Docker Workflows for Development
Docker how to
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Agile Brown Bag - Vagrant & Docker: Introduction
Developing and Deploying PHP with Docker
Docker for Web Developers: A Sneak Peek
Docker for developers
Docker for developers

More from Michał Kurzeja (12)

PDF
Refactoring legacy systems using events commands and bubble contexts
PDF
Kolejkowanie w systemach multi-tenant - PHPCon 2023
PDF
Rozszerzalność Symfony - PHPCon 2023
PDF
Event-driven architecture, the easy way.pdf
PDF
Rozszerzalność aplikacji Symfony
PDF
Docker reverse proxy z użyciem Traefik
PDF
Symfony messenger - PHPers Summit 2019
PDF
Kubernetes - 0 do 1 - 4Developers Warszawa 2019
PDF
Strangler Pattern in practice @PHPers Day 2019
PPTX
Dr Strangler and Mr Hype - Strangler pattern w praktyce
PPTX
Serverless Architecture
PPTX
Symfony2 - garść porad
Refactoring legacy systems using events commands and bubble contexts
Kolejkowanie w systemach multi-tenant - PHPCon 2023
Rozszerzalność Symfony - PHPCon 2023
Event-driven architecture, the easy way.pdf
Rozszerzalność aplikacji Symfony
Docker reverse proxy z użyciem Traefik
Symfony messenger - PHPers Summit 2019
Kubernetes - 0 do 1 - 4Developers Warszawa 2019
Strangler Pattern in practice @PHPers Day 2019
Dr Strangler and Mr Hype - Strangler pattern w praktyce
Serverless Architecture
Symfony2 - garść porad

Recently uploaded (20)

PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
MCP Security Tutorial - Beginner to Advanced
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Cost to Outsource Software Development in 2025
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
Microsoft Office 365 Crack Download Free
PPTX
Cybersecurity: Protecting the Digital World
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
DNT Brochure 2025 – ISV Solutions @ D365
GSA Content Generator Crack (2025 Latest)
Why Generative AI is the Future of Content, Code & Creativity?
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
"Secure File Sharing Solutions on AWS".pptx
Trending Python Topics for Data Visualization in 2025
Computer Software and OS of computer science of grade 11.pptx
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Designing Intelligence for the Shop Floor.pdf
MCP Security Tutorial - Beginner to Advanced
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Cost to Outsource Software Development in 2025
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
Microsoft Office 365 Crack Download Free
Cybersecurity: Protecting the Digital World

Docker - introduction