KEMBAR78
Тарас Кирилюк — Docker basics. How-to for Drupal developers | PPTX
Docker basics.
How-to
For Drupal devs
Hi @here!
I am Taras Kyryliuk
I am here because I have been
using Docker for almost a Year and
have something to say about it
2
Disclaimer: I am a Drupal developer and
automation maniac
Overview
▹ Software isolation
▹ Introducing Docker
▹ Docker in Drupal development
3
1.Software isolation
4
Why we need Software
Isolation?
Starting from the assumption that software will always
have bugs, we need a way to isolate and neutralize the
effects of the bugs…
© internet
5
6 Virtualization
Operating system-level
Containers
OpenVZ, Solaris Zones, lxc,
libcontainer
Hardware-level
Virtual machines
KVM, Xen, VMware,
VirtualBox, xhyve
Operating system-level
virtualization - Containerisation
▹Limited overhead
▹Do not require a hypervisor layer
▹Allow a greater density of containers to run on a host
▹Can be complex, hard to set up, and difficult to
manage and automate
▹Can run the same or a similar guest operating system
as the host machine
7
Containerisation
8
Hardware virtualization
▹Large overhead because of hypervisor layer
▹Easy to run and manage
▹Can run any operating system
9
Hardware virtualization
10
11
2. Introducing Docker
”
Docker is an open-source engine that
automates the deployment of applications
into containers.
12
”
Docker containers wrap a piece of software in a complete filesystem that
contains everything needed to run: code, runtime, system tools, system
libraries – anything that can be installed on a server. This guarantees that the
software will always run the same, regardless of its environment.
https://www.docker.com/what-docker
13
▹The Docker client and server
▹Docker Images
▹Registries
▹Docker Containers
14 Docker components
15
Docker
architecture
“Images are the building blocks of the Docker world.”
https://www.dockerbook.com
Ways to create images:
▹ Building an image from a Dockerfile
▹ Updating and committing an image
Docker images16
17
Building an
image from a
Dockerfile
18
Building an
image from a
Dockerfile
$ docker build -t tutorial/nginx .
Updating and committing an image
Run container:
$ docker run -t -i training/sinatra /bin/bash
Install what you need:
$ root@0b2616b0e5a8:/# apt-get install -y ruby2.0-dev
$ root@0b2616b0e5a8:/# gem2.0 install json
Commit changes:
$ docker commit -m "Added json gem" -a "Kate Smith" 0b2616b0e5a8
ouruser/sinatra:v2
https://docs.docker.com/engine/tutorials/dockerimages/
19
▹Docker Hub (public and private repositories)
▹Own private registry
▹Hosted private registry
Docker registries20
Run first container21
Container ports magic22
Host OS
8080
Container with Nginx
80
3. Docker in Drupal development
What problems we can solve using it.
23
Docker use cases
▹Use container as a Service
▹Use container as a tool
▹Run one host Drupal project with Docker Compose
▹Run own cloud with Docker Swarm
24
Container as a Service
(MySQL as an example)
Run:
$ docker run -d --name=example-mysql --env="MYSQL_ROOT_PASSWORD=mypassword" mysql
Get IP:
$ docker inspect example-mysql
Install Mysql Client:
$ apt-get install mysql-client
Profit:
$ mysql -uroot -pmypassword -h 172.17.0.20 -P 3306
mysql>
25
http://severalnines.com/blog/mysql-docker-containers-understanding-basics
Container as a Service
(MySQL as an example)26
http://severalnines.com/blog/mysql-docker-containers-understanding-basics
Use container as a tool
(PHPUnit as an example)27
https://hub.docker.com/r/phpunit/phpunit/
cd to folder with tests and Run:
$ docker run -v $(pwd):/app --rm phpunit/phpunit run
Profit!
▹ No need to install
▹ Choose any version
▹ Can use different versions for different projects
DEV-STAGE-PROD env
with Docker Compose
▹ Compose is a tool for defining and running
multi-container Docker applications.
▹ With Docker Compose, we define a set of
containers to boot up, and their runtime
properties, all defined in a YAML file.
28
Example
docker-compose.yml
29
DEV-STAGE-PROD env
with Docker Compose
You should have set of Compose-files for different environments.
▹ docker-compose.yml
▹ docker-compose.override.yml
▹ docker-compose.dev.yml
▹ docker-compose.ci.yml
▹ docker-compose.prod.yml
Run site with different commands.
Local:
$ docker-compose up -d
Dev:
$ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
See more: https://docs.docker.com/compose/extends/
30
Own cloud with Docker Swarm mode
▹ Since Docker 1.12 it supports clustering out of the
box
▹ It turns a pool of Docker hosts into a single virtual
Docker host
More: https://docs.docker.com/engine/swarm/
31
By the way!
You can forget about server provisioning!
All you need is Docker installed on any Linux
distro!
32
33
Questions?
THANK YOU!
You can find me at:
taras.kiriluk
tkiriluk@gmail.com
34

Тарас Кирилюк — Docker basics. How-to for Drupal developers

  • 1.
  • 2.
    Hi @here! I amTaras Kyryliuk I am here because I have been using Docker for almost a Year and have something to say about it 2 Disclaimer: I am a Drupal developer and automation maniac
  • 3.
    Overview ▹ Software isolation ▹Introducing Docker ▹ Docker in Drupal development 3
  • 4.
  • 5.
    Why we needSoftware Isolation? Starting from the assumption that software will always have bugs, we need a way to isolate and neutralize the effects of the bugs… © internet 5
  • 6.
    6 Virtualization Operating system-level Containers OpenVZ,Solaris Zones, lxc, libcontainer Hardware-level Virtual machines KVM, Xen, VMware, VirtualBox, xhyve
  • 7.
    Operating system-level virtualization -Containerisation ▹Limited overhead ▹Do not require a hypervisor layer ▹Allow a greater density of containers to run on a host ▹Can be complex, hard to set up, and difficult to manage and automate ▹Can run the same or a similar guest operating system as the host machine 7
  • 8.
  • 9.
    Hardware virtualization ▹Large overheadbecause of hypervisor layer ▹Easy to run and manage ▹Can run any operating system 9
  • 10.
  • 11.
  • 12.
    ” Docker is anopen-source engine that automates the deployment of applications into containers. 12
  • 13.
    ” Docker containers wrapa piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment. https://www.docker.com/what-docker 13
  • 14.
    ▹The Docker clientand server ▹Docker Images ▹Registries ▹Docker Containers 14 Docker components
  • 15.
  • 16.
    “Images are thebuilding blocks of the Docker world.” https://www.dockerbook.com Ways to create images: ▹ Building an image from a Dockerfile ▹ Updating and committing an image Docker images16
  • 17.
  • 18.
    18 Building an image froma Dockerfile $ docker build -t tutorial/nginx .
  • 19.
    Updating and committingan image Run container: $ docker run -t -i training/sinatra /bin/bash Install what you need: $ root@0b2616b0e5a8:/# apt-get install -y ruby2.0-dev $ root@0b2616b0e5a8:/# gem2.0 install json Commit changes: $ docker commit -m "Added json gem" -a "Kate Smith" 0b2616b0e5a8 ouruser/sinatra:v2 https://docs.docker.com/engine/tutorials/dockerimages/ 19
  • 20.
    ▹Docker Hub (publicand private repositories) ▹Own private registry ▹Hosted private registry Docker registries20
  • 21.
  • 22.
    Container ports magic22 HostOS 8080 Container with Nginx 80
  • 23.
    3. Docker inDrupal development What problems we can solve using it. 23
  • 24.
    Docker use cases ▹Usecontainer as a Service ▹Use container as a tool ▹Run one host Drupal project with Docker Compose ▹Run own cloud with Docker Swarm 24
  • 25.
    Container as aService (MySQL as an example) Run: $ docker run -d --name=example-mysql --env="MYSQL_ROOT_PASSWORD=mypassword" mysql Get IP: $ docker inspect example-mysql Install Mysql Client: $ apt-get install mysql-client Profit: $ mysql -uroot -pmypassword -h 172.17.0.20 -P 3306 mysql> 25 http://severalnines.com/blog/mysql-docker-containers-understanding-basics
  • 26.
    Container as aService (MySQL as an example)26 http://severalnines.com/blog/mysql-docker-containers-understanding-basics
  • 27.
    Use container asa tool (PHPUnit as an example)27 https://hub.docker.com/r/phpunit/phpunit/ cd to folder with tests and Run: $ docker run -v $(pwd):/app --rm phpunit/phpunit run Profit! ▹ No need to install ▹ Choose any version ▹ Can use different versions for different projects
  • 28.
    DEV-STAGE-PROD env with DockerCompose ▹ Compose is a tool for defining and running multi-container Docker applications. ▹ With Docker Compose, we define a set of containers to boot up, and their runtime properties, all defined in a YAML file. 28
  • 29.
  • 30.
    DEV-STAGE-PROD env with DockerCompose You should have set of Compose-files for different environments. ▹ docker-compose.yml ▹ docker-compose.override.yml ▹ docker-compose.dev.yml ▹ docker-compose.ci.yml ▹ docker-compose.prod.yml Run site with different commands. Local: $ docker-compose up -d Dev: $ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d See more: https://docs.docker.com/compose/extends/ 30
  • 31.
    Own cloud withDocker Swarm mode ▹ Since Docker 1.12 it supports clustering out of the box ▹ It turns a pool of Docker hosts into a single virtual Docker host More: https://docs.docker.com/engine/swarm/ 31
  • 32.
    By the way! Youcan forget about server provisioning! All you need is Docker installed on any Linux distro! 32
  • 33.
  • 34.
    THANK YOU! You canfind me at: taras.kiriluk tkiriluk@gmail.com 34