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
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to Docker
Manatsawin Hanmongkolchai
March 08, 2018
More Decks by Manatsawin Hanmongkolchai
See All by Manatsawin Hanmongkolchai
Nix: Declarative OS
whs
0
140
gRPC load balancing with xDS
whs
0
1.1k
ArgoCD
whs
0
500
Writing Babel Plugin
whs
0
240
What's new in Cloud Next 2019
whs
0
340
A Date with gRPC
whs
1
1.5k
ตีแผ่ Microservice ด้วย Tracing
whs
0
420
Next Generation Smart Home
whs
0
1k
Istio and the Service Mesh Architecture
whs
3
1.1k
Other Decks in Programming
See All in Programming
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
560
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
55
36k
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
120
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
680
XHTMLが残したもの
yosuke_furukawa
PRO
2
440
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
160
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
AIエージェント時代のコードレビューを設計する
nogu66
6
2.6k
Webプラットフォームで議論されているセキュリティ課題 / Security issues being discussed on Web Platforms
petamoriken
0
250
AIの中の人になってみる
htkym
0
170
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.5k
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
270
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
So, you think you're a good person
axbom
PRO
2
2.1k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
650
Code Review Best Practice
trishagee
74
20k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
520
Believing is Seeing
oripsolob
1
210
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Done Done
chrislema
186
16k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
510
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
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