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

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
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 ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
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...ICS
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
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.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
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
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.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...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
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
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

從 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