SlideShare a Scribd company logo
1 of 48
Download to read offline


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

More Related Content

More from William Yeh

給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)
給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)
給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)William Yeh
 
給 RD 的 Kubernetes 初體驗
給 RD 的 Kubernetes 初體驗給 RD 的 Kubernetes 初體驗
給 RD 的 Kubernetes 初體驗William Yeh
 
當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)
當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)
當 .NET 遇到 Kubernetes (When .NET meets Kubernetes)William Yeh
 
為了精準估算,你必須付出什麼代價?
為了精準估算,你必須付出什麼代價?為了精準估算,你必須付出什麼代價?
為了精準估算,你必須付出什麼代價?William Yeh
 
從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)
從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)
從限制理論角度談敏捷導入階段 (Agile transition: a TOC perspective)William Yeh
 
從系統思考看 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)William Yeh
 
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...William Yeh
 
軟體雲端化的要素 (Elements of Cloud-Native Apps)
軟體雲端化的要素 (Elements of Cloud-Native Apps)軟體雲端化的要素 (Elements of Cloud-Native Apps)
軟體雲端化的要素 (Elements of Cloud-Native Apps)William Yeh
 
瓶頸處理九大原則 (精簡版)
瓶頸處理九大原則 (精簡版)瓶頸處理九大原則 (精簡版)
瓶頸處理九大原則 (精簡版)William Yeh
 
Docker 導入:障礙與對策
Docker 導入:障礙與對策Docker 導入:障礙與對策
Docker 導入:障礙與對策William Yeh
 
Monitoring 改造計畫:流程觀點
Monitoring 改造計畫:流程觀點Monitoring 改造計畫:流程觀點
Monitoring 改造計畫:流程觀點William Yeh
 
從限制理論看 DevOps
從限制理論看 DevOps從限制理論看 DevOps
從限制理論看 DevOpsWilliam Yeh
 
有了 Agile,為什麼還要有 DevOps?
有了 Agile,為什麼還要有 DevOps?有了 Agile,為什麼還要有 DevOps?
有了 Agile,為什麼還要有 DevOps?William Yeh
 
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)William Yeh
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)William Yeh
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點William Yeh
 
Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享William Yeh
 
A gentle introduction to Ansible
A gentle introduction to AnsibleA gentle introduction to Ansible
A gentle introduction to AnsibleWilliam Yeh
 
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 ViewWilliam Yeh
 
On MongoDB backup
On MongoDB backupOn MongoDB backup
On MongoDB backupWilliam Yeh
 

More from 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
 

Recently uploaded

Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 

Recently uploaded (20)

Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 

從 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