Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Docker
Search
Manatsawin Hanmongkolchai
March 08, 2018
Programming
1
190
Introduction to Docker
Manatsawin Hanmongkolchai
March 08, 2018
Tweet
Share
More Decks by Manatsawin Hanmongkolchai
See All by Manatsawin Hanmongkolchai
Nix: Declarative OS
whs
0
82
gRPC load balancing with xDS
whs
0
960
ArgoCD
whs
0
420
Writing Babel Plugin
whs
0
190
What's new in Cloud Next 2019
whs
0
300
A Date with gRPC
whs
1
1.4k
ตีแผ่ Microservice ด้วย Tracing
whs
0
370
Next Generation Smart Home
whs
0
970
Istio and the Service Mesh Architecture
whs
3
1k
Other Decks in Programming
See All in Programming
知っているようで知らない"rails new"の世界 / The World of "rails new" You Think You Know but Don't
luccafort
PRO
1
110
時間軸から考えるTerraformを使う理由と留意点
fufuhu
15
4.7k
Go言語での実装を通して学ぶLLMファインチューニングの仕組み / fukuokago22-llm-peft
monochromegane
0
120
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
1
110
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.2k
Navigating Dependency Injection with Metro
zacsweers
3
240
アルテニア コンサル/ITエンジニア向け 採用ピッチ資料
altenir
0
100
Namespace and Its Future
tagomoris
6
700
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
110
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
840
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
500
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
200
Featured
See All Featured
A better future with KSS
kneath
239
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
Fireside Chat
paigeccino
39
3.6k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
Embracing the Ebb and Flow
colly
87
4.8k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
580
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Transcript
Introduction to Docker
Me • มนัสวิน หาญมงคลชัย • SKE11 • Junior Architect at
Wongnai • Wongnai is Hiring! https://careers.wongnai.com (Internship/Full time)
Review pls
Today's Agenda • ทําไม Docker ถึงเปนที่นิยม • การติดตั้งโปรแกรมจาก Docker Hub
• การสราง Docker Image จากโปรแกรมของตัวเอง • การใชงาน Docker Compose
Why Docker?
Web A Why Docker Web B 4 5
Why Docker Host OS VM A VM B 4 5
Why Docker Host OS VM A VM B 4 5
Why Docker VM A 4 Docker Hub hub.docker.com
Why Docker - for application developer • ควบคุม environment ไดเกือบ
100% • ไมมีโปรแกรม/library ที่ไมเกี่ยวของ/ผิดเวอรชั่นลงอยู • ทําซํ้าได
Running application from Docker Hub
None
Running application from Docker Hub Linux: http://172.17.0.2:2368 Windows/Mac: หา IP
จากใน Docker for Mac/Windows
Running application from Docker Hub ถาใช Docker บนระบบที่ไมใช Linux ตัว
Docker จะรันอยูบน VM ที่รัน Linux เวลาจะเขาตองเปด port เสมอ $ docker run -p 80:2368ghost (แปลวาให Port 80 ตรงกับ port 2368 ภายใน Image) เสร็จแลวเขาที่ http://localhost
Making your own image ดาวนโหลดแอพที่ https://github.com/whs/docker-course-2018 ลองรันในเครื่องดู $ npm i
$ node . ถาทําเสร็จแลว ลองแกะโคดอานดูกอน
Writing Dockerfile ไดเวลาเขียน Dockerfile!
Build & Run $ docker build -t imagename . $
docker run --init -p 80:3000 imagename
Run with environment ในโคดจะมีการอาน process.env.TEXT เพื่อใหเราสามารถกําหนดตัวแปรขณะรันได $ docker run --init
-p 80:3000 -e "TEXT=Hello Docker" imagename
Docker Compose ในโปรแกรมจริง ลงแค Node.js อยางเดียวไมพอ อาจจะตองมี MySQL, Redis, ฯลฯ
เพิ่ม ไปอีกดวย แต Docker ใหรันไดเพียงโปรแกรมเดียว จึงมีโปรแกรม Docker Compose เขามากําหนดการวาง container หลายๆ ตัว
Docker Compose เขียน compose กัน!
Docker Compose $ docker-compose up -d $ docker-compose down
Next step • Docker Compose นั้นนิยมใชกับระบบขนาดเล็กในเครื่องเดียว • สําหรับระบบ server ที่มีเครื่องจํานวนมากจะใช
Kubernetes ซึ่งจะมีการจัดสรร ทรัพยากรใหดวย • To be continued