SlideShare a Scribd company logo
1
PHPConf Taiwan 2015
2
2015-11-01-a p45 VALUME -> VOLUME @date
3
4
5
6
7
machine
compose
8
9
10
鯨⿂搬運的貨櫃
在你還在打包的時候
貨櫃早就部署好了
你有想過這個嗎?
沒有
因為你只會想到你⾃⼰。
Foundation
11
Host OS
Hypervisor
Guest OS
…
Foundation
12
Linux Kernel
Linux Distribution FS
…
Foundation
13
Linux Kernel
Linux Distribution FS
…
Base Image FS
….
Foundation
14
Linux Kernel
Your Environments
Container
Linux Distribution FS Base Image FS
….
Foundation
15
Linux Kernel
Linux Distribution FS
Your Environments
Base Image FS
Images
Container
Process Process
Image
16
Linux Kernel
Base Image
Image Layer A
Image Layer B
Image
17
Linux Kernel
Base Image
Image Layer A
Image
Layer B
Image Layer
Image
Layer C
Image
Layer
Image
Layer
Image
18
Linux Kernel
Ubuntu
PHP 5.5
Apache
PHP 7
Nginx Apache Nginx
Image
19
Linux Kernel
Ubuntu
PHP 5.5
Apache
PHP 7
Nginx Apache Nginx
CentOS
Container
20
Images
Container
Container
Container
21
Images
Process Executing
Running
Container
Container
22
Images
Exited (Stop)
Container
23
Images
Changed FS
Process Executing
Host FS
Running
Container
Container
24
Images
Changed FS
Host FS
Exited (Stop)
Container
A
Container Links
25
Container
B
Container
C
App
Container Links
26
SQL DB Redis
Links Contributes
27
Container Volumes
3f8566045a0994e.....
Host /var/www/html
……
……
Container A
(3f8566045a....)
Volume
Container Volumes
Host /var/www/html
……
……
Volume
/var/www/html
……
Container B
Volume

From
3f8566045a0994e.....
Container A
(3f8566045a....)
Container Volumes
Host
……
3f8566045a0994e.....
Container Volumes
Custom Directory
Host /var/www/html
……
……
Container A
Volume
Volume Contributes
32
33
34
35
36
37
38
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
40
FROM php:7-apache

MAINTAINER<Ruoshi Ling <foo@bar.tw>



RUN apt-get update



ADD ./script.php /app/



ENTRYPOINT php

CMD ["app/script.php"]
41
Skills (1)
42
RUN apt-get update 

&& apt-get install -y 

wget  

curl 

php5 

&& echo "Installed basic packages"
Skills (2)
43
ENV APP_VERSION=1.2.3 

DB_USER="foo" 

DB_PASSWORD="bar" 

DB_DATABASE="app" 

DB_HOST="127.0.0.1" 

ENV=production
Skills (3)
44
ENV SETUP_DIR="/var/cache/app"



COPY assets/setup/ ${SETUP_DIR}/



RUN bash ${SETUP_DIR}/install.sh
Skills (4)
45
COPY entrypoint.sh /sbin/entrypoint.sh

RUN chmod 755 /sbin/entrypoint.sh



ENTRYPOINT ["/sbin/entrypoint.sh"]

CMD ["app:start"]
Skills (5)
46
#!/bin/bash

ln -sf /data/db /var/lib/mysql

ln -sf /data/uploads /app/uploads
......

VOLUME ["/data"]

ENTRYPOINT ["/sbin/entrypoint.sh"]
Contributes
47
48
compose
swarm
machine
49
docker machine
50
$ docker-machine create 
--driver virtualbox default
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine,
run: docker-machine env default
51
$ docker-machine env default

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/fntsr/.docker/
machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"
$ eval "$(docker-machine env default)"
52
$ docker version
Client:
Version: 1.8.2
....
Server:
Version: 1.8.2
API version: 1.20
Go version: go1.4.2
Git commit: 0a8c2e3
Built: Thu Sep 10 19:10:10 UTC 2015
OS/Arch: linux/amd64
53
$ docker-machine create --driver ....
Generic
Create machines using
an existing VM/Host with SSH.
54
55
docker compose
56
自從會用 Docker
Compose 後,我
就不再下指令了呢。
認同請分享
身體健康、萬事如意、南無阿彌陀佛
有緣認識你真好
57
# Comment
<service_name>:
attribute: <value>
attribute:
- item1
- item2
58
# docker-compose.yml
web:
image: php:7-fpm
ports:
- "5566:80"
volumes:
- .:/app
59
# create container(s)
$ docker-compose up -d
# start container(s)
$ docker-compose start
# stop container(s)
$ docker-compose stop
# remove container(s)
$ docker-compose rm
60
# docker-compose.yml
web:
build: ./
links:
- mysql
ports:
- "9527:80"
mysql:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=wordpress
61
# development.yml
web:
extends:
file: docker-compose.yml
service: web
environment:
- ENV=development
- DB=sqlite3
Skills (1)
62
# docker-compose.yml
web:
....
environment:
- DB_USER=elephant

- DB_PASSWORD=ilovePHPfOEvEr

- DB_DATABASE=elephant
Skills (2)
63
# docker-compose.yml
web:
volumes:
- ./app:/app
db:
volumes:
- ./db:/var/lib/mysql
Skills (3)
64
# docker-compose.yml
web:
extends:
file: common.yml
service: web
environment:
- ENV=testing
- DB=mysqli
db:
......
Skills (4)
65
# docker-compose.yml
web:
....
restart: always
`docker run`
66
67
68
69
web:
image: wordpress
links:
- db
environment:
- WORDPRESS_DB_PASSWORD=password
ports:
- "9527:80"
db:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=wordpress
70
71
php5:
extends:
file: app.yml
service: web
image: php:5-fpm
ports:
- "11024:80"
php7:
extends:
file: app.yml
service: web
image: php:7-fpm
ports:
- "11025:80"
72
73

More Related Content

PDF
Docker 初探,實驗室中的運貨鯨
PDF
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
PDF
Docker 101 - from 0 to Docker in 30 minutes
PDF
手把手帶你學Docker 03042017
PDF
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
PPTX
Dockerizing a Symfony2 application
PDF
Docker workshop 0507 Taichung
PDF
Docker 原理與實作
Docker 初探,實驗室中的運貨鯨
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker 101 - from 0 to Docker in 30 minutes
手把手帶你學Docker 03042017
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
Dockerizing a Symfony2 application
Docker workshop 0507 Taichung
Docker 原理與實作

What's hot (20)

PPT
Learn basic ansible using docker
PDF
CoreOSによるDockerコンテナのクラスタリング
PDF
Dockerize your Symfony application - Symfony Live NYC 2014
PDF
Docker composeで開発環境をメンバに配布せよ
PPTX
Austin - Container Days - Docker 101
PDF
Getting instantly up and running with Docker and Symfony
PPTX
Deploying Symfony2 app with Ansible
PPTX
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
PDF
Docker Compose to Production with Docker Swarm
PPTX
Deploying Windows Containers on Windows Server 2016
PDF
Использование Docker в CI / Александр Акбашев (HERE Technologies)
PDF
Docker deploy
PDF
Vagrant for real (codemotion rome 2016)
PPTX
Docker workshop DevOpsDays Amsterdam 2014
PPTX
Running .NET on Docker
PPTX
Hide your development environment and application in a container
PPTX
PHP development with Docker
PDF
Rapid Development With Docker Compose
PDF
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
PDF
CoreOS : 설치부터 컨테이너 배포까지
Learn basic ansible using docker
CoreOSによるDockerコンテナのクラスタリング
Dockerize your Symfony application - Symfony Live NYC 2014
Docker composeで開発環境をメンバに配布せよ
Austin - Container Days - Docker 101
Getting instantly up and running with Docker and Symfony
Deploying Symfony2 app with Ansible
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Docker Compose to Production with Docker Swarm
Deploying Windows Containers on Windows Server 2016
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Docker deploy
Vagrant for real (codemotion rome 2016)
Docker workshop DevOpsDays Amsterdam 2014
Running .NET on Docker
Hide your development environment and application in a container
PHP development with Docker
Rapid Development With Docker Compose
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
CoreOS : 설치부터 컨테이너 배포까지
Ad

Viewers also liked (20)

PPTX
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
PDF
“Containerizing” applications with Docker: Ecosystem and Tools
PDF
Understanding the Docker ecosystem
PDF
The Docker ecosystem and the future of application deployment
PPTX
Docker Platform and Ecosystem
PDF
How to deploy PHP projects with docker
PDF
Docker ecosystem
PPTX
Docker Ecosystem: Part III - Machine
PDF
Docker ecosystem
PPTX
Docker Ecosystem on Azure
PDF
Docker Ecosystem: Engine, Compose, Machine, Swarm, Registry
PDF
The Docker Ecosystem
PPTX
ICSEC2016-Policy management for docker ecosystem
PPTX
Docker Platform and Ecosystem Nov 2015
PDF
前端工程師一定要知道的 Docker 虛擬化容器技巧
PDF
Tracxn Docker Ecosystem Startup Landscape - Feb 2015
PDF
Tracxn Research — Docker Ecosystem Startup Landscape, September 2016
PPT
component based softwrae engineering Cbse
PPTX
Engine lab software hybrid cloud specialists
PPT
MockupBuilder
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
“Containerizing” applications with Docker: Ecosystem and Tools
Understanding the Docker ecosystem
The Docker ecosystem and the future of application deployment
Docker Platform and Ecosystem
How to deploy PHP projects with docker
Docker ecosystem
Docker Ecosystem: Part III - Machine
Docker ecosystem
Docker Ecosystem on Azure
Docker Ecosystem: Engine, Compose, Machine, Swarm, Registry
The Docker Ecosystem
ICSEC2016-Policy management for docker ecosystem
Docker Platform and Ecosystem Nov 2015
前端工程師一定要知道的 Docker 虛擬化容器技巧
Tracxn Docker Ecosystem Startup Landscape - Feb 2015
Tracxn Research — Docker Ecosystem Startup Landscape, September 2016
component based softwrae engineering Cbse
Engine lab software hybrid cloud specialists
MockupBuilder
Ad

Similar to 當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem) (20)

PDF
廣宣學堂: 容器進階實務 - Docker進深研究班
PDF
Docker 進階實務班
PDF
Drone CI/CD 自動化測試及部署
PDF
桃園市教育局Docker技術入門與實作
PDF
時代在變 Docker 要會:台北 Docker 一日入門篇
PDF
手把手帶你學 Docker 入門篇
PDF
Converting Your Dev Environment to a Docker Stack - php[world]
PDF
Converting Your Dev Environment to a Docker Stack - Cascadia
PDF
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
PDF
Docker研習營
PDF
Converting your DEV Environment to a Docker Stack - ZCOE18
PDF
Converting Your DEV Environment to a Docker Stack
PDF
Docker & GitLab
PDF
PDXPortland - Dockerize Django
PDF
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
PPTX
Docker
PPTX
Academy PRO: Docker. Lecture 4
PDF
Keep it simple web development stack
PDF
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
PDF
Developing and Deploying PHP with Docker
廣宣學堂: 容器進階實務 - Docker進深研究班
Docker 進階實務班
Drone CI/CD 自動化測試及部署
桃園市教育局Docker技術入門與實作
時代在變 Docker 要會:台北 Docker 一日入門篇
手把手帶你學 Docker 入門篇
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - Cascadia
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
Docker研習營
Converting your DEV Environment to a Docker Stack - ZCOE18
Converting Your DEV Environment to a Docker Stack
Docker & GitLab
PDXPortland - Dockerize Django
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Docker
Academy PRO: Docker. Lecture 4
Keep it simple web development stack
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
Developing and Deploying PHP with Docker

Recently uploaded (20)

PPTX
1. Introduction to Computer Programming.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
August Patch Tuesday
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
Tartificialntelligence_presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Mushroom cultivation and it's methods.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
1. Introduction to Computer Programming.pptx
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
A comparative analysis of optical character recognition models for extracting...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.
Spectral efficient network and resource selection model in 5G networks
August Patch Tuesday
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
SOPHOS-XG Firewall Administrator PPT.pptx
Spectroscopy.pptx food analysis technology
Heart disease approach using modified random forest and particle swarm optimi...
Tartificialntelligence_presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Mushroom cultivation and it's methods.pdf
A comparative study of natural language inference in Swahili using monolingua...

當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)