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.3k
令和時代のSaaS開発
stormcat24
1
250
History in 5 years of CircleCI and CyberAgent
stormcat24
3
810
Kubernetes Handson Osaka
stormcat24
5
550
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
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
命名をリントする
chiroruxx
1
380
ドメインイベント増えすぎ問題
h0r15h0
1
100
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
良いユニットテストを書こう
mototakatsu
4
1.7k
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
630
return文におけるstd::moveについて
onihusube
1
730
CSC305 Lecture 26
javiergs
PRO
0
140
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
200
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
120
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
The Cult of Friendly URLs
andyhume
78
6.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
RailsConf 2023
tenderlove
29
940
Side Projects
sachag
452
42k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Embracing the Ebb and Flow
colly
84
4.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Optimizing for Happiness
mojombo
376
70k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
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.