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
C++でシェーダを書く
fadis
6
4.1k
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
Click-free releases & the making of a CLI app
oheyadam
2
120
Jakarta EE meets AI
ivargrimstad
0
130
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
みんなでプロポーザルを書いてみた
yuriko1211
0
280
Better Code Design in PHP
afilina
PRO
0
130
役立つログに取り組もう
irof
28
9.6k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7.1k
How GitHub (no longer) Works
holman
310
140k
Thoughts on Productivity
jonyablonski
67
4.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
A Modern Web Designer's Workflow
chriscoyier
693
190k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Documentation Writing (for coders)
carmenintech
65
4.4k
A better future with KSS
kneath
238
17k
A designer walks into a library…
pauljervisheath
204
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.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.