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
Dockerfileを素早く書くtips&ライブデモ
Search
Mitsuki Ogasahara
October 21, 2016
Technology
2
1.8k
Dockerfileを素早く書くtips&ライブデモ
2016/10/21 JX通信社の社内勉強会で話した内容です
Mitsuki Ogasahara
October 21, 2016
Tweet
Share
More Decks by Mitsuki Ogasahara
See All by Mitsuki Ogasahara
ひとり情シスなCTOがLLMと始めるオペレーション最適化 / CTO's LLM-Powered Ops
yamitzky
0
600
コスト管理から向き合う技術的負債 / Accounting for Technical Debt Through Cost Management
yamitzky
0
48
Utility-first な CSS-in-JS 〜Tailwind CSS と Chakra UI を添えて〜 / Utility-First CSS-in-JS
yamitzky
5
1.5k
今から始める型安全 Python / Start Python Type Hints
yamitzky
13
4.9k
技術が好きで好きで好きでたまらないエンジニアが「取締役」になって思う、マネジメントキャリアパス / My Manager's Path
yamitzky
2
1.1k
Python 3.9 時代の型安全な Pythonの極め方 / Mastering Type Safety in Python 3.9 Era
yamitzky
35
30k
なぜサーバーレスとDockerなのか 〜 インフラ運用を最小化するサービス開発 〜 / Why We Choose Serverless AND Docker
yamitzky
0
4.1k
サーバーレスを活用して少数精鋭で開発するニュースアプリ #devsumi
yamitzky
4
3k
ここが辛いよサーバーレス だが私は乗り越えた #builderscon
yamitzky
14
7.9k
Other Decks in Technology
See All in Technology
Where will it converge?
ibknadedeji
0
180
実装で解き明かす並行処理の歴史
zozotech
PRO
1
340
Trust as Infrastructure
bcantrill
0
340
SwiftUIのGeometryReaderとScrollViewを基礎から応用まで学び直す:設計と活用事例
fumiyasac0921
0
140
AI ReadyなData PlatformとしてのAutonomous Databaseアップデート
oracle4engineer
PRO
0
180
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
20k
20250929_QaaS_vol20
mura_shin
0
110
自作LLM Native GORM Pluginで実現する AI Agentバックテスト基盤構築
po3rin
2
250
生成AIとM5Stack / M5 Japan Tour 2025 Autumn 東京
you
PRO
0
210
Findy Team+のSOC2取得までの道のり
rvirus0817
0
340
多様な事業ドメインのクリエイターへ 価値を届けるための営みについて
massyuu
0
160
VCC 2025 Write-up
bata_24
0
180
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Agile that works and the tools we love
rasmusluckow
331
21k
Building Applications with DynamoDB
mza
96
6.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
The Language of Interfaces
destraynor
162
25k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
RailsConf 2023
tenderlove
30
1.2k
Building Adaptive Systems
keathley
43
2.8k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
114
20k
Typedesign – Prime Four
hannesfritz
42
2.8k
Transcript
@yamitzky %PDLFSpMFΛ ૉૣ͘࡞Δ UJQTˍϥΠϒσϞ 2016/10/21 JXࣾษڧձ
w ͕ࣗ%PDLFSpMFΛॻ͘ͱ͖ʹɺ Ͳ͏͍͏ڥͰॻ͍͍ͯΔ͔Λڞ༗ˍσϞ͠·͢ w ʮ͜͏͢Δͱͬͱޮྑ͍ΑʂʯͳͲ͋ͬͨΒ ϚαΧϦ͓ئ͍͠·͢ Today…
w ίϯςφܕͷԾԽڥΛఏڙ͢Δ044 w %PDLFSpMFʹΑͬͯ%PDLFSΠϝʔδΛఆٛͰ͖Δ w Ϗϧυͨ͠%PDLFSΠϝʔδ%PDLFS3FHJTUSZͰެ։Ͱ͖ɺ ଞͷڥͰ͑ΔΑ͏ʹڞ༗Ͱ͖Δ What is Docker?
%PDLFSpMFΛॻ͍ͯɺ ΞϓϦέʔγϣϯΛ୭Ͱ͑ΔΑ͏ʹ͠Α͏ʂ
w ࠷͕ۙࣗॻ͍ͨ%PDLFSpMF w EPDLFSDPNQPTF w BQFY w NFDBC w +6."/
w FUDʜ Recently… %PDLFSΠϝʔδΛڞ༗͢Ε AEPDLFSSVOA͚ͩͰ.BDͰ8JOEPXTͰ-JOVYͰ ར༻Ͱ͖ΔΑ͏ʹʂ
#BE1SBDUJDF
Bad Practice to Write Dockerfile $ 5FSNJOBM
Bad Practice to Write Dockerfile $ vim Dockerfile 0QFOFEJUPS
Bad Practice to Write Dockerfile FROM alpine RUN apk add
—no-cache curl RUN command to take long time RUN some typo command 8SJUF%PDLFSpMF
Bad Practice to Write Dockerfile $ docker build . #VJME%PDLFSJNBHFBOEXBJUʜ
... (wait for 10 min)
Bad Practice to Write Dockerfile $ docker build . &SSPS
... ... /bin/sh: typo: not found The command '/bin/sh -c typo' returned a non-zero code: 127
None
Bad Iteration $ build ☕ 8SJUF #VJME8BJU &SSPS
#FTU1SBDUJDF
Best Practice to Write Dockerfile 5NVYɺ7JNɺ4MJNFΛͬͯ Ұߦͣͭ%PDLFSpMFΛ͔֬ΊΔ Ҏ্ɻ
%&.0
Best Practice to Write Dockerfile $ 3VOUNVYTQMJUQBOF $
Best Practice to Write Dockerfile $ vim Dockerfile $ docker
run -it alpine /bin/sh &EJU%PDLFSpMF 3VOCBTFJNBHF`TTIFMM
Best Practice to Write Dockerfile / # 8SJUFKVTUPOFMJOF FROM alpine
RUN apk add —no-cache curl 4IFMMJTSVOOJOH
Best Practice to Write Dockerfile / # apk add —no-cache
curl &YFDVUFPOFMJOFWJB4-*.& FROM alpine RUN apk add —no-cache curl
w ʮWJNTMJNFʯͱ͔ʮFNBDTTMJNFʯͰݕࡧʂ w ΤσΟλʔͷબ෦ΛɺUNVYͷผQBOFʹૹΓɺ ࣮ߦͰ͖ΔϓϥάΠϯ Slime? IUUQTHJUIVCDPNKQBMBSEZWJNTMJNF
Best Practice to Write Dockerfile / # apk add —no-cache
curl &YFDVUFPOFMJOFWJB4-*.& FROM alpine RUN apk add —no-cache curl
/ # some command Best Practice to Write Dockerfile /
# apk add —no-cache curl … &YFDVUFPOFMJOFWJB4-*.& FROM alpine RUN apk add —no-cache curl RUN some command
/ # some command … Best Practice to Write Dockerfile
/ # apk add —no-cache curl … &YFDVUFPOFMJOFWJB4-*.& FROM alpine RUN apk add —no-cache curl RUN some command RUN other command / # other command
Finally… $ docker build . 4BWFCVJMEJU $ ... ... Successfully
built
w UNVYͱWJNͱTMJNFΛ༻ҙ͢Δ w ҰߦͣͭTMJNFͰ࣮ߦ͔ͯ͠Βɺ࠷ޙʹAEPDLFSCVJMEA w λʔϛφϧʹ̍ߦͣͭίʔυΛૹΕΕԿͰྑ͍Αʂ ྫɿFNBDTTMJNFͱ͔JOUFMMJ+ͱ͔ Conclusion