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
コスト管理から向き合う技術的負債 / Accounting for Technical Debt Through Cost Management
yamitzky
0
3
Utility-first な CSS-in-JS 〜Tailwind CSS と Chakra UI を添えて〜 / Utility-First CSS-in-JS
yamitzky
5
1.3k
今から始める型安全 Python / Start Python Type Hints
yamitzky
13
4.7k
技術が好きで好きで好きでたまらないエンジニアが「取締役」になって思う、マネジメントキャリアパス / My Manager's Path
yamitzky
2
960
Python 3.9 時代の型安全な Pythonの極め方 / Mastering Type Safety in Python 3.9 Era
yamitzky
35
29k
なぜサーバーレスとDockerなのか 〜 インフラ運用を最小化するサービス開発 〜 / Why We Choose Serverless AND Docker
yamitzky
0
3.9k
サーバーレスを活用して少数精鋭で開発するニュースアプリ #devsumi
yamitzky
4
2.8k
ここが辛いよサーバーレス だが私は乗り越えた #builderscon
yamitzky
14
7.7k
会社の開発合宿で Electron-vueで Slackクライアント作ってみた
yamitzky
0
2.6k
Other Decks in Technology
See All in Technology
kargoの魅力について伝える
magisystem0408
0
210
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.4k
なぜCodeceptJSを選んだか
goataka
0
160
Storage Browser for Amazon S3
miu_crescent
1
170
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
290
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
.NET 9 のパフォーマンス改善
nenonaninu
0
940
C++26 エラー性動作
faithandbrave
2
740
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
A Philosophy of Restraint
colly
203
16k
A better future with KSS
kneath
238
17k
For a Future-Friendly Web
brad_frost
175
9.4k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Why Our Code Smells
bkeepers
PRO
335
57k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
How to train your dragon (web standard)
notwaldorf
88
5.7k
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