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
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
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
命名をリントする
chiroruxx
1
410
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
良いユニットテストを書こう
mototakatsu
8
2.4k
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
6
1.3k
Recoilを剥がしている話
kirik
5
6.7k
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
280
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
470
Beyond ORM
77web
7
840
Symfony Mapper Component
soyuka
2
730
Featured
See All Featured
Docker and Python
trallard
42
3.1k
The Pragmatic Product Professional
lauravandoore
32
6.3k
BBQ
matthewcrist
85
9.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Speed Design
sergeychernyshev
25
670
Why Our Code Smells
bkeepers
PRO
335
57k
Building an army of robots
kneath
302
44k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
4 Signs Your Business is Dying
shpigford
181
21k
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.