29
From Development to Production with Docker and Docker Datacenter PHPKonf Istanbul 21 May 2016

From Development to Production with Docker and Docker Datacenter

Embed Size (px)

Citation preview

Page 1: From Development to Production with Docker and Docker Datacenter

FromDevelopmenttoProductionwithDockerandDockerDatacenter

PHPKonf Istanbul21May2016

Page 2: From Development to Production with Docker and Docker Datacenter

LorenzoFontana

@fntlnz

• DevOps Expertat Kiratech• Techincal writer fortheCodeship’s blog• VIMPHPMaintainer• Also aPHPDeveloper• Automate everything!• https://github.com/fntlnz• https://twitter.com/fntlnz• Idon’tlikevowels• http://fntlnz.wtf

Page 3: From Development to Production with Docker and Docker Datacenter

AboutKiratech

Page 4: From Development to Production with Docker and Docker Datacenter

AboutKiratech

1° CertifiedPartnerinItalia

Page 5: From Development to Production with Docker and Docker Datacenter

WhatisDocker?

“Docker containers wrap up a piece of software in a complete filesystem that contains

everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it

will always run the same, regardless of the environment it is running in.”

https://www.docker.com/what-docker

Page 6: From Development to Production with Docker and Docker Datacenter

Onceuponatime….VMs!

Page 7: From Development to Production with Docker and Docker Datacenter

Afewconceptshere…

•Docker images•Docker containers•Docker volumes•Docker networks

Page 8: From Development to Production with Docker and Docker Datacenter

Yoursystemisalreadycontainerised!

• Namespaces:limitswhatyoucanuse.(netns,user,pid etc…)• Cgroups:limitshowmuchyoucanuse(memory,CPU,IO,Network,devices)• Copyonwritestorage• Andmuchmore:)

What’sbehindacontainer?

Page 9: From Development to Production with Docker and Docker Datacenter

OSSEcosystem

•Docker Engine•DockerMachine•DockerSwarm•DockerCompose•DockerRegistry(andthepublicDockerhub)•Notary• Interlock• Something newreleased afew minutesago

Page 10: From Development to Production with Docker and Docker Datacenter

DockercanrunPHPprogramstoo!

Page 11: From Development to Production with Docker and Docker Datacenter

Fromnowon,wewillhaveafewdemos

Maytheforcebewithme

Page 12: From Development to Production with Docker and Docker Datacenter

AsimplePHPcontainer

docker run -it \-p 8080:8080 \php:7.0.6-alpine \sh -c 'mkdir /code;echo "<?php phpinfo();"> /code/index.php;php -S 0.0.0.0:8080 -t /code'

Page 13: From Development to Production with Docker and Docker Datacenter

AcustomDockerfile forthis

FROM php:7.0.6-alpine

ADD code/ /code

EXPOSE 8080

CMD ["php", "-S", "0.0.0.0:8080", "-t", "/code"]

Page 14: From Development to Production with Docker and Docker Datacenter

Ok,but,IwantaWebserver,adatabase,akeyvaluestoreanda

messagebroker!

Page 15: From Development to Production with Docker and Docker Datacenter

Onecontainerperservice!Wealreadyneedtwoofthem,

PHP-FPMandNGINX

Page 16: From Development to Production with Docker and Docker Datacenter

Orchestratingcontainerdependenciesmanuallyispainful

Page 17: From Development to Production with Docker and Docker Datacenter

docker-composeTOTHERESCUE!

Page 18: From Development to Production with Docker and Docker Datacenter

version: '2'services:

nginx:image: nginx:latestports:

- "80:80"links:

- phpvolumes_from:

- php

php:build: php:7.0.6-fpm-alpineexpose:

- "9000"volumes:

- ./:/var/www/application

Asimpledocker-compose.yml

Page 19: From Development to Production with Docker and Docker Datacenter

DEMOTIME!

Page 20: From Development to Production with Docker and Docker Datacenter

CSEcosystem

• CSEngines• UCP• DTR

Page 21: From Development to Production with Docker and Docker Datacenter

DockerDatacenter

Page 22: From Development to Production with Docker and Docker Datacenter

UCP

• GUIformanagementofapps,containers,networks,images,volumes etc..• Built-inauthentication• AD/LDAPauthentication• Compatiblewithdocker-compose• ExposestheDockerAPI• BackedbySwarm• Built-inHA• Commerciallysupported• MonitoringandloggingofUCPusersandevents

Page 23: From Development to Production with Docker and Docker Datacenter

DEMOTIME!

Page 24: From Development to Production with Docker and Docker Datacenter

DTR

• GUI• Built-inauthentication• AD/LDAPauthentication• Userauditlogs• RBAC• Built-inHA• DockerContentTrustimageandsigningverification• MonitoringandloggingofUCPusersandevents

Page 25: From Development to Production with Docker and Docker Datacenter

DEMOTIME!

Page 26: From Development to Production with Docker and Docker Datacenter

Monitoring

• ElasticDockerBeat+Kibana• Cadvisor• Prometheus• Graylog• IntegratedinUCP!

Page 27: From Development to Production with Docker and Docker Datacenter

Questions?

Page 28: From Development to Production with Docker and Docker Datacenter

https://joind.in/talk/c3d3f

Ratethetalk!

Page 29: From Development to Production with Docker and Docker Datacenter

WAAAAAAAIT!Ihave afew stickers withme:D

Justask if you want one!

You cantweet @fntlnz if you can’t findme,but you should I’m somewhat big