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
お前のDockerイメージはまだ重い💢💢💢
Search
stormcat24
February 05, 2016
Programming
62
36k
お前のDockerイメージはまだ重い💢💢💢
2016/02/05 JAWS-UG コンテナ支部 #4
stormcat24
February 05, 2016
Tweet
Share
More Decks by stormcat24
See All by stormcat24
素早く賢く失敗するDeveloper Productivityの実現を目指して
stormcat24
4
4.6k
KubernetesのマニフェストをそれなりにCIしたい
stormcat24
4
1.2k
令和時代のSaaS開発
stormcat24
1
240
History in 5 years of CircleCI and CyberAgent
stormcat24
3
810
Kubernetes Handson Osaka
stormcat24
5
540
Kubernetes Handson
stormcat24
5
4.2k
DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
stormcat24
0
290
Base Image Journey 2018
stormcat24
29
130k
kotlin-fest
stormcat24
13
17k
Other Decks in Programming
See All in Programming
Better Code Design in PHP
afilina
PRO
0
120
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.8k
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1k
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Jakarta EE meets AI
ivargrimstad
0
510
Macとオーディオ再生 2024/11/02
yusukeito
0
370
受け取る人から提供する人になるということ
little_rubyist
0
230
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Why Our Code Smells
bkeepers
PRO
334
57k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Ruby is Unlike a Banana
tanoku
97
11k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
RailsConf 2023
tenderlove
29
900
Transcript
͓લͷ%PDLFSΠϝʔδ ·ͩॏ͍ 2016/02/05 JAWS-UG ίϯςφࢧ෦ #4 @stormcat24 ʙମࢷ1έλͷDockerΠϝʔδΛࢦͯ͠ʙ
‣ @stormcat24 ‣ Akinori Yamada ‣ CyberAgent, Inc ‣ Technical
Engineer ‣ DevOps ‣ http://stormcat.hatenablog.com ‣ AmebaFRESH!
"NFCB'3&4)
ौ୩ఆΧϝϥͱ͔
ण࢘ϥΠϒͱ͔
AmebaFRESH! is Full Dockernized Service! by EC2 Container Service
ͦ͏͍લճΓ·ͨ͠ https://speakerdeck.com/stormcat24/next-fresh-applications-with-amazon-ecs
લճͷɾɾɾ ‣ FRESH!ͷECSͬͨΞʔΩςΫνϟ ‣ Blue Green Deploymentͱ͔ ‣ docker-machineͰͷϩʔΧϧ։ൃ ‣
DockerΠϝʔδͷݮྔ ‣ ͦͷଞDevOpsͱ͔
ࠓݮྔͷ͚ͩ͠·͢
ಥવͰ͕͢
(#ͷ%PDLFSΠϝʔδ QVMMʹԿඵ͔͔Δʁ
ଌఆ݅ ‣ EC2্ͷPrivate Docker Registry(V2)Λར༻ ‣ Registry͕ར༻͢ΔετϨʔδS3 ‣ ಉҰϦʔδϣϯͷEC2͔ΒࢦఆͷΠϝʔδΛdocker pull͢Δ
‣ EC2ɺS3ڞʹap-northeast-1(Tokyo) ‣ EC2্ʹΠϝʔδͷϨΠϠʔΩϟογϡଘࡏ͠ ͳ͍ͷͱ͢Δ
"OTXFSඵ ※ΠϝʔδʹΑͬͯࠩͪΖΜ͋Γ·͢
࣮͜Ε͔ͳΓ݅ ‣ EC2ͱRegistry, S3ಉҰϦʔδϣϯͳͷͰϨΠς ϯγ ‣ DockerHubʹಉΠϝʔδΛஔ͍ͨ߹ɺ75ඵ͘ Β͍ͩͬͨ
ඵͳΒѱ͘ͳ͍ɾɾɾʁ
͍ɺݱ࣮ݫ͍͠
ίϯςφ̍ͭͰཱ͠ͳ͍
զʑଟ͘ͷίϯςφΛӡ༻͢Δɹ ‣ ༷ʑͳׂͷίϯϙʔωϯτͰγεςϜཱ ‣ ଞͷίϯςφͱڠௐͯ͠ಈ͘ ‣ td-agentͷग़൪ଟ͍ ‣ 1ͭͷϗετΛσϓϩΠ͢ΔͷʹɺෳͷDockerί ϯςφΛpull͢Δඞཁ͕͋Δ
ίϯςφʹඵɺ͍
%PDLFSΠϝʔδ͕େ͖͍ͱ ‣ ΠϝʔδͷϏϧυɺCI࣌ؒ↑ ‣ Πϝʔδͷμϯϩʔυ࣌ؒ↑ ‣ ΠϝʔδͷΞοϓϩʔυ࣌ؒ↑ ‣ ੜ࢈ੑ↓ ‣
Twitter͢Δ࣌ؒ↑
ӡ༻ʹٴ΅͢Өڹ ‣ σϓϩΠ࣌ؒ↑ ‣ “ࣺͯΔΠϯϑϥӡ༻”ͷ߹ɺΠϝʔδͷϨΠϠʔ Ωϟογϡʹ͋·ΓཔΕͳ͍ʢϑϧμϯϩʔυ ͕ଟ͍ʣ ‣ EC2ͷAutoScalingͰՃ͞ΕͨΠϯελϯε͕ αʔϏεΠϯ͢Δ·Ͱͷ࣌ؒ↑
ॏ͍%PDLFSΠϝʔδ ྑ͍͜ͱແ͠
͚ܰΕ͍ܰ΄Ͳ Ձ͕͋Δ
ΑΖ͍͠ɺͰݮྔͩ
Πϝʔδݮྔϝιου ‣ ΠϝʔδͷϨΠϠʔΛݮΒ͢ ‣ ࢈ۀഇغΛదʹॲཧ͢Δ ‣ ϘϦϡʔϜϚϯτΛ׆༻͢Δ ‣ ͍ܰϕʔεΠϝʔδͷબఆ ‣
ϘτϧωοΫʢࢷ͕͍ͭͯΔՕॴʣΛಛఆ͢Δ ‣ ΞϓϦέʔγϣϯΛখ͘͢͞Δ
ϨΠϠʔΛݮΒ͢ ‣ DockerΠϝʔδεςʔδຖʹϨΠϠʔΛੜ͢ ΔʢϨΠϠʔߏʣ ‣ ϨΠϠʔࣗΠϝʔδͳͷͰɺϨΠϠʔΛݮΒ ͤαΠζݮΔ
36/ΛνΣʔϯ͢Δ 36/FDIPEFCIUUQQQBMBVODIQBEOFUOHJOYTUBCMFVCVOUVUSVTUZNBJOa FUDBQUTPVSDFTMJTUEOHJOYTUBCMFMJTUa BQULFZBEWLFZTFSWFSLFZTFSWFSVCVOUVDPNSFDWLFZT$&&$a BQUHFUVQEBUFZa BQUHFUJOTUBMMZOHJOYFYUSBTa BQUHFUJOTUBMMZPQFOTTMa BQUHFUJOTUBMMZHFPJQEBUBCBTFa
࢈ۀഇغΛదʹॲཧ͢Δ ‣ ࢈ۀഇغʹdocker build࣌ʹੜͨ͡ɺΞϓϦέʔ γϣϯ࣮ߦʹෆཁͳπʔϧϑΝΠϧ ‣ yumapt-getͷΰϛ ‣ Ϗϧυʹ༻ͨ͠ιʔε ‣
gitͰ͢Β࢈ۀഇغ ‣ Ռ͚ͩ͢͜ͱΛҙࣝ͢Δ
ϘϦϡʔϜϚϯτΛ׆༻͢Δ ‣ ϗετʹඞཁͳσΟϨΫτϦΛஔ͠ɺίϯςφʹ Ϛϯτ͢Δ͜ͱͰΠϝʔδͷαΠζΛݮ͢Δ ‣ ݮςΫχοΫͱͯ͠༗ޮ ‣ ϗετʹґଘ͢ΔΑ͏ʹͳΔͨΊɺϙʔλϏϦςΟ མͪΔ
%PDLFS)VC
%PDLFS)VC ‣ DockerΠϝʔδͷGitHubΈ͍ͨͳΜ ‣ ཉ͍͠ͷେखʹೖΔ ‣ ༷ʑͳϓϩμΫτͷެࣜΠϝʔδ͕ଟ͘ϗετ͞Ε ͍ͯΔ ‣ ීஈԿؾͳ͘͢Δdocker
pullͰɺ͔͜͜ΒΠϝʔ δΛμϯϩʔυ͢Δ
ΠϝʔδͷαΠζΛ֬ೝͰ͖Δ
ެࣜΠϝʔδΛ͏͖͔ʁ ‣ όʔδϣϯ๛Ͱ࣭తʹܭࢉͰ͖Δ͕ɾɾɾ ‣ ΠϝʔδͷαΠζඞͣ͠࠷దԽ͞Ε͍ͯΔͱ ݶΒͳ͍ͷͰαΠζ֬ೝॏཁ ‣ ϝδϟʔͲ͜Ζubuntudebianϕʔε͕ଟ͍ ‣ Dockerfileͷϊϋ͚͍ͩͯɺϕʔεΠϝʔδ
͚ͩม͑Δͷબࢶ
TDSBUDI ‣ ͓ͦΒ͘ݱଘ࠷খͷDockerΠϝʔδ ‣ shlsͳ͍ ‣ ࣮amazon/amazon-ecs-agent(9MB)ͷϕʔε ‣ ඞཁͳͷશ෦ηϧϑαʔϏε
#VTZCPY ‣ ܰྔͰΠϝʔδ600KBʙ2MB ‣ ݩΈࠐΈܥLinuxͷσϑΝΫτͩͬͨ ‣ γΣϧash ‣ ѻ͍͔ͳΓ͍͠ʢதͰϏϧυ͠Α͏ͱࢥ͏ͳʣ ‣
goͷ࣮ߦϑΝΠϧΛCOPY͘Β͍͕ؔͷࢁ
"MQJOF-JOVY ‣ Πϝʔδ2MB ‣ ࣮Busyboxϕʔε ‣ APKͱ͍͏ύοέʔδཧγεςϜ͕͋ΔͷͰɺ BusyboxΑΓѻ͍͍͢
"1,Ͱ͕ΜͬͯΔྫ 36/BQLVQEBUFBEEPQFOTTMEFWQDSFEFW[MJCEFWXHFUCVJMECBTFa NLEJSQUNQTSDa DEUNQTSDa XHFUIUUQOHJOYPSHEPXOMPBEOHJOYUBSH[a UBS[YWGOHJOYUBSH[UBSH[a DEUNQTSDOHJOYUBSH[a DPOpHVSFa XJUIIUUQ@TTM@NPEVMFa XJUIIUUQ@H[JQ@TUBUJD@NPEVMFa
QSFpYFUDOHJOYa IUUQMPHQBUIWBSMPHOHJOYBDDFTTMPHa FSSPSMPHQBUIWBSMPHOHJOYFSSPSMPHa TCJOQBUIVTSMPDBMTCJOOHJOYa NBLFa NBLFJOTUBMMa BQLEFMCVJMECBTFa SNSGUNQTSDa SNSGWBSDBDIFBQL
"MQJOFੜओཁΠϝʔδ ‣ anapsix/alpine-javaʢ50MBʣ ‣ cwt114/alpine-nodeʢ15MBʣ ‣ frolvlad/alpine-rubyʢ10MBʣ ‣ frolvlad/alpine-goʢ50MBʣ ‣
ಉ͡Α͏ͳͷΰϩΰϩస͕ͬͯΔ
ࠓͷͱ͜Ζͷ"MQJOFॴײ ‣ ཪͰຊ൪ೖͷػӡΛͬͯΔʢλΠϛϯά࣍ୈʣ ‣ nginx͕150MB→20MB͘Β͍ ‣ ฏۉ80%͘Β͍ͷݮ͕ظͰ͖Δ ‣ Web/APIͷECS Taskʢίϯςφ4छʣͰ200-
300MB͘Β͍ɺ1͘Β͍Ͱpull+runͰ͖Δ
ܰ͞ͱͷτϨʔυΦϑ ‣ Dockerfile࡞Γ͕৬ਓܳʹͳΓ͕ͪ ‣ AlpineͷϦϙδτϦʹ͋Δύοέʔδͷόʔδϣϯ ͕ͦΕ΄Ͳ৽Ͱͳ͍ ‣ ࠷৽൛ͷϛυϧΣΞΛೖΕΔͷʹɺιʔείϯύ Πϧ͔Β࢝ΊͨΓ͢Δඞཁ͕͋Δ
*NBHF-BZFSJP ‣ https://imagelayers.io ‣ DockerΠϝʔδͷϨΠϠʔΛՄࢹԽͯ͘͠ΕΔ αʔϏε ‣ DockerHub࿈ܞ ‣ ଠ͍ՕॴΛҰൃͰஅͯ͘͠ΕΔ
None
%PDLFS)VCͱ࿈ܞͰ͖Δ
ͲͷϨΠϠʔʹ ࢷ͕͍ͭͯΔ͔ Ұྎવ
ಠࣗϨδετϦͰ͑Δʁ ‣ GitHubͱDockerHubʹެ։͞ΕͯΔ ‣ centurylink/imagelayers-api ‣ centurylink/imagelayers-ui ‣ ϨδετϦΛࠩ͠ସ͑ΒΕΔΈʹͳͬͯͳ͍ ‣
Registry(V1)લఏͷ༷ ‣ forkͯͪ͠ΐͬͱؤுΕɾɾɾ
ΞϓϦέʔγϣϯΛখ͘͢͞Δ ‣ ίϯςφ࣌ͰαΠζͷখ͞͞ΘΕΔ ‣ Dockerܳਓʹ֤ݴޠͷϏϧυπʔϧͷࣝ ΘΕΔ ‣ Node: npm ‣
Java/Scala: Maven, Gradle, sbt ‣ Go: godep, glide
ΞϓϦέʔγϣϯϨϕϧͰͷݮྔ ‣ ෆཁϞδϡʔϧͷআ ‣ ෆཁͳґଘϥΠϒϥϦͷআɺϥΠϒϥϦͷείʔ ϓͷݟ͠ ‣ ↑ͷͨΊͷϦϑΝΫλϦϯά ‣ ੩తϑΝΠϧɺ֎෦ʹग़ͤͦ͏ͳϦιʔεͷબผ
%PDLFS༗ࣝऀ͚ͩͰޭ͠ͳ͍ ‣ ίϯςφϕʔεͰӡ༻͢Δ͚ͩͰ͋ΕɺDocker ༗ࣝऀ͚ͩͰͳΜͱ͔ͳΔ͕ɾɾɾ ‣ ReactͷαʔόαΠυϨϯμϦϯάʑɺϑϩϯτ دΓͷྖҬͰͷཧղΛಘΔ͜ͱ͕ॏཁ ‣ ߴ͍ϨϕϧͰͷӡ༻ʹɺDocker༗ࣝऀʹٻΊΒ ΕΔٕज़ྖҬ࣮͍
·ͱΊ ‣ ॏ͗͢ΔΠϝʔδӡ༻ͷোนʹͳΔ ‣ ϙʔλϏϦςΟͱɺܰ͞Λ݉Ͷඋ͑ͯͦ͜ྑ͍ DockerΠϝʔδ ‣ ެࣜΠϝʔδա৴͢Δͳ ‣ Alpine(ɾ㱼ɾ)ŘŘŮ!!
‣ ΞϓϦͷστοΫεΕͣʹ
ࢦͤɺମࢷέλ
Thank you.