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
10
Utility-first な CSS-in-JS 〜Tailwind CSS と Chakra UI を添えて〜 / Utility-First CSS-in-JS
yamitzky
5
1.4k
今から始める型安全 Python / Start Python Type Hints
yamitzky
13
4.8k
技術が好きで好きで好きでたまらないエンジニアが「取締役」になって思う、マネジメントキャリアパス / My Manager's Path
yamitzky
2
1k
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.9k
ここが辛いよサーバーレス だが私は乗り越えた #builderscon
yamitzky
14
7.7k
会社の開発合宿で Electron-vueで Slackクライアント作ってみた
yamitzky
0
2.6k
Other Decks in Technology
See All in Technology
データエンジニアリング領域におけるDuckDBのユースケース
chanyou0311
2
220
CDKのコードを書く環境を作りました with Amazon Q
nobuhitomorioka
1
120
2.5Dモデルのすべて
yu4u
2
950
システム・ML活用を広げるdbtのデータモデリング / Expanding System & ML Use with dbt Modeling
i125
1
290
LINEギフトにおけるバックエンド開発
lycorptech_jp
PRO
0
120
データ資産をシームレスに伝達するためのイベント駆動型アーキテクチャ
kakehashi
PRO
2
620
Share my, our lessons from the road to re:Invent
naospon
0
110
ローカルLLMを活用したコード生成と、ローコード開発ツールへの応用
kazuhitoyokoi
0
140
「正しく」失敗できる チームの作り方 〜リアルな事例から紐解く失敗を恐れない組織とは〜 / A team that can fail correctly
i35_267
1
570
OSS構成管理ツールCMDBuildを使ったAWSリソース管理の自動化
satorufunai
0
370
なぜ私は自分が使わないサービスを作るのか? / Why would I create a service that I would not use?
aiandrox
0
890
【内製開発Summit 2025】イオンスマートテクノロジーの内製化組織の作り方/In-house-development-summit-AST
aeonpeople
1
140
Featured
See All Featured
Docker and Python
trallard
44
3.3k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Designing for Performance
lara
604
68k
For a Future-Friendly Web
brad_frost
176
9.5k
Documentation Writing (for coders)
carmenintech
67
4.6k
Writing Fast Ruby
sferik
628
61k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
BBQ
matthewcrist
87
9.5k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Into the Great Unknown - MozCon
thekraken
35
1.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
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