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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Manatsawin Hanmongkolchai
March 08, 2018
Programming
210
1
Share
Introduction to Docker
Manatsawin Hanmongkolchai
March 08, 2018
More Decks by Manatsawin Hanmongkolchai
See All by Manatsawin Hanmongkolchai
Nix: Declarative OS
whs
0
120
gRPC load balancing with xDS
whs
0
1.1k
ArgoCD
whs
0
480
Writing Babel Plugin
whs
0
220
What's new in Cloud Next 2019
whs
0
330
A Date with gRPC
whs
1
1.5k
ตีแผ่ Microservice ด้วย Tracing
whs
0
410
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
Swiftのレキシカルスコープ管理
kntkymt
0
170
AWSはOSSをどのように 考えているのか?
akihisaikeda
0
130
1人1案件のプロダクトエンジニア時代に、"プロセス監督"としてチャレンジしたこと
non0113
0
150
AI Agent と正しく分析するための環境作り
yoshyum
2
560
Hive Metastoreを通して学ぶIceberg REST Catalog ― 仕様から実装まで
okumin
0
230
Sans tests, vos agents ne sont pas fiables
nabondance
0
140
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
140
過去のレビュー知見をSkillsで資産化した話
pkshadeck
PRO
1
2.2k
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
380
横断組織出身のQAEがインプロセスQAEでつまずいたこと・活かせたこと
ty89
0
170
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
390
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
270
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
200
Building Adaptive Systems
keathley
44
3k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Being A Developer After 40
akosma
91
590k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
180
Testing 201, or: Great Expectations
jmmastey
46
8.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
570
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
550
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
200
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
The untapped power of vector embeddings
frankvandijk
2
1.7k
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