From Development to Production with Docker and Docker Datacenter

Preview:

Citation preview

FromDevelopmenttoProductionwithDockerandDockerDatacenter

PHPKonf Istanbul21May2016

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

AboutKiratech

AboutKiratech

1° CertifiedPartnerinItalia

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

Onceuponatime….VMs!

Afewconceptshere…

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

Yoursystemisalreadycontainerised!

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

What’sbehindacontainer?

OSSEcosystem

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

DockercanrunPHPprogramstoo!

Fromnowon,wewillhaveafewdemos

Maytheforcebewithme

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'

AcustomDockerfile forthis

FROM php:7.0.6-alpine

ADD code/ /code

EXPOSE 8080

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

Ok,but,IwantaWebserver,adatabase,akeyvaluestoreanda

messagebroker!

Onecontainerperservice!Wealreadyneedtwoofthem,

PHP-FPMandNGINX

Orchestratingcontainerdependenciesmanuallyispainful

docker-composeTOTHERESCUE!

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

DEMOTIME!

CSEcosystem

• CSEngines• UCP• DTR

DockerDatacenter

UCP

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

DEMOTIME!

DTR

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

DEMOTIME!

Monitoring

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

Questions?

https://joind.in/talk/c3d3f

Ratethetalk!

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

Recommended