15
PHP uygulamalarını Docker ile çalıştırmak ‘15

PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Embed Size (px)

Citation preview

Page 1: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

PHP uygulamalarını Docker ile çalıştırmak

‘15

Page 2: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Berat Doğanberatdgan gmail.com

beratdganberatdogan

Page 3: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Sanallaştırma

Page 4: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak
Page 5: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

“Container” Sanallaştırması

Page 6: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

VMs vs. Containers

Page 7: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

LXC Nasıl Mümkün Olabiliyor?

namespaces

cgroups

farklı işlem, kullanıcı, ağ ağaçlarını mümkün kılıyor

işlemci, bellek, disk i/o yönetimi

Page 8: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

≠LXC Docker

Page 9: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Docker neler sunuyor?

Engine Hub/Registry Compose

Machine Swarm Kitematic

Page 10: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Docker 101root@phpkonf:~# docker run hello-worldUnable to find image 'hello-world:latest' locally latest: Pulling from hello-world … Status: Downloaded newer image for hello-world:latest

Hello from Docker. This message shows that your installation appears to be working correctly.

To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash

root@phpkonf:~# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS f912ea95c1b0 hello-world "/hello" 8 minutes ago Exited (0) 8 minutes ago

Page 11: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Docker 1001root@phpkonf:~# echo '<?php echo "Hello World!";' > index.php

root@phpkonf:~# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 10cd4a32778b php:latest "php index.php" A minute ago Exited (0) 13 seconds ago randomnameee

root@phpkonf:~# docker run -v “$PWD":/code -w /code php:latest php index.phpHello World

Container Linkleme

Page 12: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Dockerfile# Yorum satırı KOMUT parametre [parametre parametre]

FROM, MAINTAINER, RUN, CMD, EXPOSE, ENV, ADD, COPY, ENTRYPOINT, VOLUME, WORKDIR

CounterStrike Server ^^

Page 13: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Docker Compose (Fig)

Elegan bir YAML sintaksa sahip.

Multi-container’dan oluşan uygulamaları yönetmemizi kolaylaştırıyor.

Eskiden adı Fig olan bir proje olarak başlamıştı. Tutunca Docker satın aldı. :$

Page 14: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

DemoLaravel uygulamasını “Dockerize” edip,

çalıştırmak.

Page 15: PHPKonf'15 PHP Uygulamalarını Docker ile Çalıştırmak

Sorular?