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.7k
KubernetesのマニフェストをそれなりにCIしたい
stormcat24
4
1.3k
令和時代のSaaS開発
stormcat24
1
250
History in 5 years of CircleCI and CyberAgent
stormcat24
3
820
Kubernetes Handson Osaka
stormcat24
5
550
Kubernetes Handson
stormcat24
5
4.2k
DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
stormcat24
0
300
Base Image Journey 2018
stormcat24
29
130k
kotlin-fest
stormcat24
13
17k
Other Decks in Programming
See All in Programming
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
320
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
240
Оптимизируем производительность блока Казначейство
lamodatech
0
850
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
190
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
780
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
870
テストケースの名前はどうつけるべきか?
orgachem
PRO
1
180
為你自己學 Python
eddie
0
490
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
520
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
320
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
190
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
850
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Site-Speed That Sticks
csswizardry
2
210
A Tale of Four Properties
chriscoyier
157
23k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Code Reviewing Like a Champion
maltzj
521
39k
Making the Leap to Tech Lead
cromwellryan
133
9k
Speed Design
sergeychernyshev
25
720
Building Adaptive Systems
keathley
38
2.3k
Why Our Code Smells
bkeepers
PRO
335
57k
A Philosophy of Restraint
colly
203
16k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
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.