SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne


Build Docker images with Ansible:
A half-blood approach
William Yeh 

2016-08-27
http://bit.ly/halfblood-docker
Docker is great, but…
Dare you fully migrate your apps to Docker?
Q1
Co-exist?
Q2
The Old Way The Docker Way
Build pipeline
Configuration management
Deployment pipeline
Build pipeline
Configuration management
Deployment pipeline
inconvenient…
Reuse old, and apply to new…
The Old Way The Docker Way
Build pipeline
Configuration management
Deployment pipeline
Build pipeline
Configuration management
Deployment pipeline
… with minimal effort
… smooth learning curve
… ease of maintenance
… graceful degradation
… be a good citizen
My proposal:
Should fits into Docker model.
Should be of good quality.
… be a good citizen
in the Docker world
Nginx wrk Boom json-server
built via
package
manager
C compiler Go compiler
Node.js
runtime
http://bit.ly/halfblood-docker
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
1. Use CM to build image.
Base image:

williamyeh/ansible
playbook
1. Use CM to build image.

2. Adapt for Dockerized app.
Major

1. Process execution model.

2. Storage model (embrace immutable infra, please).

3. Network model.
Ref. "Dockerized app " 

http://william-yeh.github.io/docker-workshop/slides/dockerize.html
Minor

4. Log handling.

5. Init/upstart/systemd handling.

6. Wrapper scripts as new entrypoint, if necessary.
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.
Base image: williamyeh/ansible:mini-debian8
Minimal configuration:

the Ansible body will be removed when mission completed.
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
Base image: williamyeh/ansible:mini-alpine3
Ref:

1. " Docker image "

http://william-yeh.github.io/docker-mini/

2. " Alpine Linux"

http://school.soft-arch.net/courses/docker-part2/lectures/885446
use Alpine Linux in Ansible playbooks.
playbook
nginx
Background info
• Written in C

• Can be installed via OS-level package manager

(apt, yum, apk, …)
nginx
Debian
Ubuntu
CentOS
RHEL
Fedora
Alpine
1. Use CM to build image.
nginx
playbook
1. Use CM to build image.
nginx
1. Use CM to build image.
nginx
├─<missing> Virtual Size: 125.1 MB
│ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie
│ │
│ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild
│ │
│ └─482d24d32738 Virtual Size: 210.5 MB
│ │
│ └─5b8665aa9bbc Virtual Size: 241.2 MB Tags: nginx-1:latest
1. Use CM to build image.
nginx
nginx
1. Use CM to build image.

2. Adapt for Dockerized app.
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.
nginx
williamyeh/ansible:mini-debian8
williamyeh/ansible:debian8-onbuild
Base image:
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.
nginx
├─<missing> Virtual Size: 125.1 MB
│ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie
│ │
│ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8
│ │ └─68b7807607da Virtual Size: 135.9 MB Tags: nginx-3:latest
│ │
│ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild
│ └─482d24d32738 Virtual Size: 210.5 MB
│ └─5b8665aa9bbc Virtual Size: 241.2 MB Tags: nginx-1:latest
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
nginx
williamyeh/ansible:mini-alpine3
williamyeh/ansible:mini-debian8
Base image:
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
nginx
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
nginx
├─<missing> Virtual Size: 4.8 MB Tags: alpine:3.4
│ │
│ └─c887641f2cdb Virtual Size: 4.8 MB Tags: williamyeh/ansible:mini-alpine3
│ └─b57f615a2cd9 Virtual Size: 6.8 MB Tags: nginx-4:latest
│
├─<missing> Virtual Size: 125.1 MB
│ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie
│ │
│ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8
│ │ └─68b7807607da Virtual Size: 135.9 MB Tags: nginx-3:latest
│ │
│ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild
│ └─482d24d32738 Virtual Size: 210.5 MB
│ └─5b8665aa9bbc Virtual Size: 241.2 MB Tags: nginx-1:latest
Should be of good quality.
… be a good citizen in the Docker world
wrk
Background info
• Written in C

• Need to be compiled with gcc (& make).
wrk
https://github.com/wg/wrk
Modern HTTP benchmarking tool
1. Use CM to build image.
wrk
playbook
1. Use CM to build image.
wrk
1. Use CM to build image.
wrk
├─<missing> Virtual Size: 125.1 MB
│ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie
│ │
│ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild
│ │
│ └─482d24d32738 Virtual Size: 210.5 MB
│ └─e755d268bd41 Virtual Size: 341.0 MB Tags: wrk-1:latest
1. Use CM to build image.
wrk
wrk
1. Use CM to build image.

2. Adapt for Dockerized app.
N/A
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.
wrk
williamyeh/ansible:mini-debian8
williamyeh/ansible:debian8-onbuild
Base image:
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.
wrk
├─<missing> Virtual Size: 125.1 MB
│ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie
│ │
│ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8
│ │ └─980aa6023fda Virtual Size: 164.3 MB Tags: wrk-3:latest
│ │
│ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild
│ └─482d24d32738 Virtual Size: 210.5 MB
│ └─e755d268bd41 Virtual Size: 341.0 MB Tags: wrk-1:latest
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
wrk
williamyeh/ansible:mini-alpine3
williamyeh/ansible:mini-debian8
Base image:
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
wrk
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
wrk
├─<missing> Virtual Size: 4.8 MB Tags: alpine:3.4
│ │
│ └─c887641f2cdb Virtual Size: 4.8 MB Tags: williamyeh/ansible:mini-alpine3
│ └─531aed862a98 Virtual Size: 9.1 MB Tags: wrk-4:latest
│
├─<missing> Virtual Size: 125.1 MB
│ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie
│ │
│ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8
│ │ └─980aa6023fda Virtual Size: 164.3 MB Tags: wrk-3:latest
│ │
│ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild
│ └─482d24d32738 Virtual Size: 210.5 MB
│ └─e755d268bd41 Virtual Size: 341.0 MB Tags: wrk-1:latest
Should be of good quality.
… be a good citizen in the Docker world
Should be of good quality.
… be a good citizen in the Docker world
Boom

json-server
Background info
• Written in Go

• Need to be compiled.

• Written in Node.js

• Need to install Node.js runtime.
Boom
json-server
├─<missing> Virtual Size: 4.8 MB Tags: alpine:3.4
│ │
│ └─c887641f2cdb Virtual Size: 4.8 MB Tags: williamyeh/ansible:mini-alpine3
│ │
│ ├─fc72e24cae3c Virtual Size: 14.5 MB Tags: williamyeh/boom:latest
│ │

│ └─bfd0226b6d74 Virtual Size: 27.5 MB Tags: williamyeh/json-server:latest
https://github.com/William-Yeh/docker-boom
https://github.com/William-Yeh/docker-json-server
Conclusion
… whether you’d like to dive into Docker

(fully or partially)
“Infrastructure as Code” mindset
… having alternatives is good
Consider Plan B
1. Use CM to build image.

2. Adapt for Dockerized app.

3. Slim down the image.

4. Pursue for minimal image.
Nginx wrk Boom json-server
built via
package
manager
C compiler Go compiler
Node.js
runtime
(near-) minimal
size (MiB)
6.8 9.1 14.51 27.48
http://bit.ly/halfblood-docker

Contenu connexe

Plus de William Yeh

Plus de William Yeh (20)

給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)
給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)
給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)
 
給 RD 的 Kubernetes 初體驗
給 RD 的 Kubernetes 初體驗給 RD 的 Kubernetes 初體驗
給 RD 的 Kubernetes 初體驗
 
當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)
當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)
當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)
 
為了精準估算,你必須付出什麼代價?
為了精準估算,你必須付出什麼代價?為了精準估算,你必須付出什麼代價?
為了精準估算,你必須付出什麼代價?
 
從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)
從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)
從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)
 
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
 
DevOps to Agile 敏捷轉型經驗  (From DevOps to Agile: Transformation Experience of G...
DevOps to Agile 敏捷轉型經驗  (From DevOps to Agile: Transformation Experience of G...DevOps to Agile 敏捷轉型經驗  (From DevOps to Agile: Transformation Experience of G...
DevOps to Agile 敏捷轉型經驗  (From DevOps to Agile: Transformation Experience of G...
 
軟體雲端化的要素 (Elements of Cloud-Native Apps)
軟體雲端化的要素 (Elements of Cloud-Native Apps)軟體雲端化的要素 (Elements of Cloud-Native Apps)
軟體雲端化的要素 (Elements of Cloud-Native Apps)
 
瓶頸處理九大原則 (精簡版)
瓶頸處理九大原則 (精簡版)瓶頸處理九大原則 (精簡版)
瓶頸處理九大原則 (精簡版)
 
Docker 導入:障礙與對策
Docker 導入:障礙與對策Docker 導入:障礙與對策
Docker 導入:障礙與對策
 
Monitoring 改造計畫:流程觀點
Monitoring 改造計畫:流程觀點Monitoring 改造計畫:流程觀點
Monitoring 改造計畫:流程觀點
 
從限制理論看 DevOps
從限制理論看 DevOps從限制理論看 DevOps
從限制理論看 DevOps
 
有了 Agile,為什麼還要有 DevOps?
有了 Agile,為什麼還要有 DevOps?有了 Agile,為什麼還要有 DevOps?
有了 Agile,為什麼還要有 DevOps?
 
Docker 對傳統 DevOps 工具鏈的衝擊 (Docker's Impact on traditional DevOps toolchain)
Docker 對傳統 DevOps 工具鏈的衝擊 (Docker's Impact on traditional DevOps toolchain)Docker 對傳統 DevOps 工具鏈的衝擊 (Docker's Impact on traditional DevOps toolchain)
Docker 對傳統 DevOps 工具鏈的衝擊 (Docker's Impact on traditional DevOps toolchain)
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享
 
A gentle introduction to Ansible
A gentle introduction to AnsibleA gentle introduction to Ansible
A gentle introduction to Ansible
 
12 Factor App from Docker's Point of View
12 Factor App from Docker's Point of View12 Factor App from Docker's Point of View
12 Factor App from Docker's Point of View
 
On MongoDB backup
On MongoDB backupOn MongoDB backup
On MongoDB backup
 

Dernier

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 

從 Ansible 到 Docker:混血模式 (Build Docker images with Ansible: A half-blood approach)

  • 1. 
 Build Docker images with Ansible: A half-blood approach William Yeh 
 2016-08-27 http://bit.ly/halfblood-docker
  • 3. Dare you fully migrate your apps to Docker? Q1
  • 4. Co-exist? Q2 The Old Way The Docker Way Build pipeline Configuration management Deployment pipeline Build pipeline Configuration management Deployment pipeline inconvenient…
  • 5. Reuse old, and apply to new… The Old Way The Docker Way Build pipeline Configuration management Deployment pipeline Build pipeline Configuration management Deployment pipeline … with minimal effort … smooth learning curve … ease of maintenance … graceful degradation … be a good citizen My proposal:
  • 6. Should fits into Docker model. Should be of good quality. … be a good citizen in the Docker world
  • 7. Nginx wrk Boom json-server built via package manager C compiler Go compiler Node.js runtime http://bit.ly/halfblood-docker
  • 8. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image.
  • 9. 1. Use CM to build image. Base image:
 williamyeh/ansible playbook
  • 10. 1. Use CM to build image. 2. Adapt for Dockerized app. Major 1. Process execution model. 2. Storage model (embrace immutable infra, please). 3. Network model. Ref. "Dockerized app " 
 http://william-yeh.github.io/docker-workshop/slides/dockerize.html Minor 4. Log handling. 5. Init/upstart/systemd handling. 6. Wrapper scripts as new entrypoint, if necessary.
  • 11. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. Base image: williamyeh/ansible:mini-debian8 Minimal configuration: the Ansible body will be removed when mission completed.
  • 12. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. Base image: williamyeh/ansible:mini-alpine3 Ref: 1. " Docker image " http://william-yeh.github.io/docker-mini/ 2. " Alpine Linux"
 http://school.soft-arch.net/courses/docker-part2/lectures/885446 use Alpine Linux in Ansible playbooks. playbook
  • 13. nginx
  • 14. Background info • Written in C • Can be installed via OS-level package manager
 (apt, yum, apk, …) nginx Debian Ubuntu CentOS RHEL Fedora Alpine
  • 15. 1. Use CM to build image. nginx playbook
  • 16. 1. Use CM to build image. nginx
  • 17. 1. Use CM to build image. nginx
  • 18. ├─<missing> Virtual Size: 125.1 MB │ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie │ │ │ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild │ │ │ └─482d24d32738 Virtual Size: 210.5 MB │ │ │ └─5b8665aa9bbc Virtual Size: 241.2 MB Tags: nginx-1:latest 1. Use CM to build image. nginx
  • 19. nginx 1. Use CM to build image. 2. Adapt for Dockerized app.
  • 20. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. nginx williamyeh/ansible:mini-debian8 williamyeh/ansible:debian8-onbuild Base image:
  • 21. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. nginx ├─<missing> Virtual Size: 125.1 MB │ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie │ │ │ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8 │ │ └─68b7807607da Virtual Size: 135.9 MB Tags: nginx-3:latest │ │ │ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild │ └─482d24d32738 Virtual Size: 210.5 MB │ └─5b8665aa9bbc Virtual Size: 241.2 MB Tags: nginx-1:latest
  • 22. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. nginx williamyeh/ansible:mini-alpine3 williamyeh/ansible:mini-debian8 Base image:
  • 23. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. nginx
  • 24. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. nginx ├─<missing> Virtual Size: 4.8 MB Tags: alpine:3.4 │ │ │ └─c887641f2cdb Virtual Size: 4.8 MB Tags: williamyeh/ansible:mini-alpine3 │ └─b57f615a2cd9 Virtual Size: 6.8 MB Tags: nginx-4:latest │ ├─<missing> Virtual Size: 125.1 MB │ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie │ │ │ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8 │ │ └─68b7807607da Virtual Size: 135.9 MB Tags: nginx-3:latest │ │ │ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild │ └─482d24d32738 Virtual Size: 210.5 MB │ └─5b8665aa9bbc Virtual Size: 241.2 MB Tags: nginx-1:latest
  • 25. Should be of good quality. … be a good citizen in the Docker world
  • 26. wrk
  • 27. Background info • Written in C • Need to be compiled with gcc (& make). wrk https://github.com/wg/wrk Modern HTTP benchmarking tool
  • 28. 1. Use CM to build image. wrk playbook
  • 29. 1. Use CM to build image. wrk
  • 30. 1. Use CM to build image. wrk
  • 31. ├─<missing> Virtual Size: 125.1 MB │ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie │ │ │ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild │ │ │ └─482d24d32738 Virtual Size: 210.5 MB │ └─e755d268bd41 Virtual Size: 341.0 MB Tags: wrk-1:latest 1. Use CM to build image. wrk
  • 32. wrk 1. Use CM to build image. 2. Adapt for Dockerized app. N/A
  • 33. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. wrk williamyeh/ansible:mini-debian8 williamyeh/ansible:debian8-onbuild Base image:
  • 34. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. wrk ├─<missing> Virtual Size: 125.1 MB │ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie │ │ │ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8 │ │ └─980aa6023fda Virtual Size: 164.3 MB Tags: wrk-3:latest │ │ │ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild │ └─482d24d32738 Virtual Size: 210.5 MB │ └─e755d268bd41 Virtual Size: 341.0 MB Tags: wrk-1:latest
  • 35. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. wrk williamyeh/ansible:mini-alpine3 williamyeh/ansible:mini-debian8 Base image:
  • 36. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. wrk
  • 37. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image. wrk ├─<missing> Virtual Size: 4.8 MB Tags: alpine:3.4 │ │ │ └─c887641f2cdb Virtual Size: 4.8 MB Tags: williamyeh/ansible:mini-alpine3 │ └─531aed862a98 Virtual Size: 9.1 MB Tags: wrk-4:latest │ ├─<missing> Virtual Size: 125.1 MB │ └─<missing> Virtual Size: 125.1 MB Tags: debian:jessie │ │ │ ├─cb9b094476db Virtual Size: 125.1 MB Tags: williamyeh/ansible:mini-debian8 │ │ └─980aa6023fda Virtual Size: 164.3 MB Tags: wrk-3:latest │ │ │ └─ad7fe256ceb4 Virtual Size: 200.9 MB Tags: williamyeh/ansible:debian8-onbuild │ └─482d24d32738 Virtual Size: 210.5 MB │ └─e755d268bd41 Virtual Size: 341.0 MB Tags: wrk-1:latest
  • 38. Should be of good quality. … be a good citizen in the Docker world
  • 39. Should be of good quality. … be a good citizen in the Docker world
  • 41. Background info • Written in Go • Need to be compiled. • Written in Node.js • Need to install Node.js runtime. Boom json-server
  • 42. ├─<missing> Virtual Size: 4.8 MB Tags: alpine:3.4 │ │ │ └─c887641f2cdb Virtual Size: 4.8 MB Tags: williamyeh/ansible:mini-alpine3 │ │ │ ├─fc72e24cae3c Virtual Size: 14.5 MB Tags: williamyeh/boom:latest │ │
 │ └─bfd0226b6d74 Virtual Size: 27.5 MB Tags: williamyeh/json-server:latest https://github.com/William-Yeh/docker-boom https://github.com/William-Yeh/docker-json-server
  • 44. … whether you’d like to dive into Docker
 (fully or partially) “Infrastructure as Code” mindset
  • 45. … having alternatives is good Consider Plan B
  • 46. 1. Use CM to build image. 2. Adapt for Dockerized app. 3. Slim down the image. 4. Pursue for minimal image.
  • 47. Nginx wrk Boom json-server built via package manager C compiler Go compiler Node.js runtime (near-) minimal size (MiB) 6.8 9.1 14.51 27.48