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
Utility-first な CSS-in-JS 〜Tailwind CSS と Chakra UI を添えて〜 / Utility-First CSS-in-JS
yamitzky
5
1.2k
今から始める型安全 Python / Start Python Type Hints
yamitzky
13
4.7k
技術が好きで好きで好きでたまらないエンジニアが「取締役」になって思う、マネジメントキャリアパス / My Manager's Path
yamitzky
2
930
Python 3.9 時代の型安全な Pythonの極め方 / Mastering Type Safety in Python 3.9 Era
yamitzky
35
28k
なぜサーバーレスとDockerなのか 〜 インフラ運用を最小化するサービス開発 〜 / Why We Choose Serverless AND Docker
yamitzky
0
3.8k
サーバーレスを活用して少数精鋭で開発するニュースアプリ #devsumi
yamitzky
4
2.8k
ここが辛いよサーバーレス だが私は乗り越えた #builderscon
yamitzky
14
7.6k
会社の開発合宿で Electron-vueで Slackクライアント作ってみた
yamitzky
0
2.6k
GitLabのSlack連携を魔改造して作る開発を楽しくする仕組み
yamitzky
1
2.4k
Other Decks in Technology
See All in Technology
フロントエンド・オブザーバビリティを支える要素技術を学ぼう
sadnessojisan
2
180
四国のあのイベントの〇〇システムを45日間で構築した話 / cloudohenro2024_tachibana
biatunky
0
330
Agile in Automotive Industry, puzzles and lights.
hiranabe
3
1.3k
Road to Single Activity
yurihondo
1
230
DuckDB雑紹介(1.1対応版)@DuckDB座談会
ktz
6
1.4k
効果的なオンコール対応と障害対応
ryuichi1208
5
2.9k
ネットワークだけ隔離されたコンテナ作成デモ / Kichijoji.pm36
tenforward
1
210
JEP 480: Structured Concurrency
aya_ebata
0
130
テスト”ケース”駆動開発 で手戻りをなくそう
ryohma0510
0
290
なぜクラウドサービスで Web コンソールを提供するのか
shuta13
4
2k
自社サービスのための独自リリース版Redmine「RedMica」の取り組み
vividtone
0
1.3k
技術的負債解消の取り組みと専門チームのお話
bengo4com
0
330
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
Optimizing for Happiness
mojombo
375
69k
KATA
mclloyd
27
13k
Scaling GitHub
holman
458
140k
In The Pink: A Labor of Love
frogandcode
139
22k
RailsConf 2023
tenderlove
28
810
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
8.9k
Designing Experiences People Love
moore
138
23k
Embracing the Ebb and Flow
colly
83
4.4k
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