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
コンテナは友だち! /friends-who-are-good-at-containers
Search
KONDO Uchio
September 14, 2017
Technology
13
2.8k
コンテナは友だち! /friends-who-are-good-at-containers
2017年 pepabo 新卒エンジニア座学
----
追記・修正
p.16 LXDはGo言語で開発されている
https://github.com/lxc/lxd
KONDO Uchio
September 14, 2017
Tweet
Share
More Decks by KONDO Uchio
See All by KONDO Uchio
大規模レガシーテストを 倒すための CI基盤の作り方 / #CICD2023
udzura
5
2.3k
Ruby x BPF in Action / RubyKaigi 2022
udzura
0
190
Narrative of Ruby & Rust
udzura
0
170
開発者生産性指標の可視化 / pepabo-four-keys
udzura
3
1.6k
Talk of RBS
udzura
0
390
Re: みなさん最近どうですか? / FGN tech meetup in 2021
udzura
0
710
Dockerとやわらかい仮想化 - ProSec-IT/SECKUN 2021 edition -
udzura
2
670
Device access filtering in cgroup v2
udzura
1
770
"Story of Rucy" on RubyKaigi takeout 2021
udzura
0
720
Other Decks in Technology
See All in Technology
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
330
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
180
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
170
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
670
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
120
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Six Lessons from altMBA
skipperchong
27
3.5k
Building an army of robots
kneath
302
43k
BBQ
matthewcrist
85
9.3k
How STYLIGHT went responsive
nonsquared
95
5.2k
What's in a price? How to price your products and services
michaelherold
243
12k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Navigating Team Friction
lara
183
14k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Transcript
ා͘ͳ͍γεςϜϓϩάϥϛϯά ۙ౻Ӊஐ࿕(.01FQBCP *OD ৽ଔΤϯδχΞ࠲ֶ ίϯςφ༑ͩͪʂ
ΤϯδχΞ ۙ౻Ӊஐ࿕!VE[VSB ٕज़෦ٕज़ج൫νʔϜ ͖ͳϥʔϝϯΒʔΊΜཾ (.0ϖύϘॴଐ
ࠓͷΞδΣϯμ w ϓϩηεͱԿͩΖ͏ʁ w ίϯςφͱԿͩΖ͏ʁ w ΈΜͳίϯςφʹͳͬͯΈΑ͏ʁʁʁ
ϓϩηεͱʁ
'SPNް͍ຊ w-*/69ϓϩάϥϛϯάΠϯλʔϑΣʔε ΦϥΠϦʔ ͜ͷதͰҰ൪ް͍ຊ
ϓϩηεͱϓϩάϥϜͷ࣮ߦதͷ࢟Ͱ͢ ʮϓϩηεͱɺϓϩάϥϜͷ࣮ߦʹඞཁ ͳγεςϜϦιʔεΛׂΓͯΔͨΊɺΧʔ ωϧ͕ఆٛ͢ΔநΤϯςΟςΟͰ͋Δʯͱ ݴ͍͑ΒΕ·͢ɻ ʰ-JOVYϓϩάϥϛϯάΠϯλʔϑΣʔεʱষϓϩηε
ϓϩηεͱ৮Ε߹͏ wʮϓϩάϥϜͷ࣮ߦʹඞཁͳϦιʔεʯΛ͍ͯΈΔ wͦΕ͕ɺ͢ͳΘͪϓϩηεଐੑͰ͋Δ wྫ w 1*%ɺ1*% w εςʔλεʢ࣮ߦՄೳɺ*0ͪɺʣ w ڥม
w ϑΝΠϧσΟεΫϦϓλςʔϒϧ w 6TFS*%(SPVQ*% w ݖݶʢ,FSOFM$BQBCJMJUZʣ w ΧϨϯτσΟϨΫτϦ w ϝϞϦϚοϐϯά
TUSVDUUBTL@TUSVDU
QSPDQSPDGT wγεςϜϓϩηεͷใΛऔಘͰ͖ΔಛघϑΝΠϧγεςϜ wQSPDͷԼʹ࠷ॳ͔ΒϚϯτ͞Ε͍ͯΔ߹͕ଟ͍ɻ wϚϯτ͞Ε͍ͯͳ͍ͱ͑ͳ͍πʔϧ͋ΔʢQTɺUPQͦͷଞʣ
தΛݟͯΈΑ͏ wԋश ͘ଘࡏ͢ΔΑ͏ͳϓϩηεΛ࡞ͬͯΈΑ͏ɻ w ͦͷϓϩηεͷ1*%Λಛఆ͠Α͏ɻ w ͦͷϓϩηεʹ͍ͭͯɺҎԼͷใΛऔಘͯ͠ΈΑ͏ɻ
w ΧϨϯτσΟϨΫτϦ IJOUQSPD1*%DXE w ڥม IJOUQSPD1*%FOWJSPO w ϝϞϦϚοϐϯά IJOUQSPD1*%NBQT w εϨουͷ IJOUQSPD1*%UBTL
ίϯςφͱʁ
ԾԽͷछྨʢҰྫʣ wϋΠύʔόΠβܕʢωΠςΟϒϋΠύʔόΠβʣ wઐ༻ͷ04ɺ-JOVY,FSOFMࣗମΛϋΠύʔόΠβͱ͍ͯ͠ɺͦͷ ্Ͱ04ΛΒͤΔ wϗετ04ܕʢϗετϋΠύʔόΠβʣ w൚༻తͳ04ͷ্ʹɺ7JSUVBM#PYͷΑ͏ͳԾԽͷͨΊͷઐ༻ιϑτ ΣΞΛೖΕͯΒͤΔ wίϯςφܕˠ
ίϯςφͱ wখ͞ͳಠཱͨ͠ڥΛɺҰͭͷ04ͷ্ʹ࡞Δٕज़ɻ wͨͩ͠ɺԾԽٕज़ͷΑ͏ʹѻΘΕΔ͕ɺԿ͔ΛԾతʹ࡞͍ͬͯΔ ͱ͍͏͜ͱͰͳ͍
ίϯςφ ಛघͳϓϩηεͰ͋Δ
͜Ε͚֮ͩ͑ͯؼͬͯ͘Εʂʂ̍
ίϯςφͷ࣮ w%PDLFS(PMBOHɻ,VCFSOFUFTͳͲͱ࿈ܞ͠ɺঃʑʹ׆༻γʔϯ ͕·͍ͬͯΔ w-9$-9%ΧʔωϧͷίϯςφϨϑΝϨϯε࣮తཱͪҐஔɻ$ w)BDPOJXBNSVCZ $ݴޠͰͰ͖ͨίϯςφɻ3VCZͷ%4-Ͱίϯ ςφΛఆٛͰ͖Δɻ(.0ϖύϘͱ͍͏ձ͕ࣾϚωʔδυΫϥυͷ όοΫΤϯυʹ࠾༻͠ʹɻ
ίϯςφͲ͏ͬͯ࡞ΒΕ͍ͯΔ͔ wࠓ͋͛ͨ-JOVYίϯςφͷ࣮Ͱɺجຊతʹಉ͡ΧʔωϧͷػೳΛ Έ߹Θͤͯɺʮখ͘͞ಠཱͨ͠ڥʯΛ࡞͍ͬͯΔɻ wͦͷػೳ͕ద༻͞Ε͍ͯΔ͔͍ͳ͍͔ɺϓϩηεͷଐੑͰ͋Δͷ ͰɺQSPDͷԼͳͲ͔Β֬ೝ͢Δ͜ͱ͕Ͱ͖·͢
%PDLFSͰίϯςφΛ࡞ͬͯΈΑ͏
QSPD1*%OTͷԼΛݟͯΈΑ͏
͜Εɺଞͷϓϩηεͱҧ͍ͬͯΔ wͱ͍͏͜ͱΛ֬ೝ͢Δ
͜Εɺଞͷϓϩηεͱҧ͍ͬͯΔ wͱ͍͏͜ͱΛ֬ೝ͢Δ ◀ ◀ ◀ ◀ ◀
-JOVY/BNFTQBDF
-JOVY/BNFTQBDFͱ wΧʔωϧɺάϩʔόϧͰཧ͍ͯ͠ΔϦιʔε͕ͨ͘͞Μ͋Δɻ wͦ͏͍͏Ϧιʔεͷ͏ͪҰ෦ɺ໊લۭؒΛͬͯɺಛఆͷϓϩηε ͨͪͷͨΊʹผͷϦιʔεΛ֬อ͢Δ͜ͱ͕Ͱ͖Δ w654/BNFTQBDFϗετ໊ͳͲ w1*%/BNFTQBDFϓϩηε*% w/FUXPSL/BNFTQBDFωοτϫʔΫઃఆʢ/*$ଞʣ wͳͲͳͲɻ࠷৽ͷ-JOVYͰਓͷࣆͭͷ/BNFTQBDF
QSPD1*%OTͱ wʮͦͷϓϩηε͕ॴଐ͢Δ/BNFTQBDFΛදݱ͢ΔϑΝΠϧʯΛ ݟ͚ͭΔ͜ͱ͕Ͱ͖ΔσΟϨΫτϦ w͋Δϓϩηεͱɺผͷϓϩηε͕ҧ͏ϑΝΠϧʢJOPEF൪߸ʣΛ ͍ࠩͯ͠Εɺͦͷϓϩηεͨͪผʑͷ໊લۭؒʹ͍ΔͶɺ ͱ֬ೝͰ͖Δ
DHSPVQ
QSPD1*%DHSPVQͱ͍͏ϑΝΠϧ wͳʹΒಛघͳจࣈྻ͕ॻ͔Ε͍ͯΔ
࣮ࡍͷσΟϨΫτϦʹରԠ͢Δ wTZTGTDHSPVQͱ͍͏ͱ͜ΖΛௐΔͱ
͜Ε͕DHSPVQ wDHSPVQɺͱͱϓϩηεΛάϧʔϐϯά͢ΔͨΊͷػೳɻ wϓϩηεͷάϧʔϓຖʹɺ$16ͷར༻Ͱ͋ͬͨΓɺϝϞϦͰ͋ͬͨ Γɺ1*%ͷͰ͋ͬͨΓɺͷ੍ݶΛ͔͚Δ͜ͱ͕Ͱ͖Δɻ͋Δ͍ɺ άϧʔϓผͷར༻ঢ়گΛ֬ೝͨ͠ΓͰ͖Δ wDHSPVQʹؔ͢Δૢ࡞ɺDHSPVQGTͱ͍͏ಛघϑΝΠϧγεςϜΛ ܦ༝ͯ͠Ͱ͖Δ
࣮ࡍͷ੍ݶΛ֬ೝ •docker run --pids-limit=128 -ti debian:jessie /bin/bash wͷΑ͏ͳίϚϯυͰɺϓϩηεͷDHSPVQ੍ݶΛ͔͚ΒΕΔ w͜ͷγΣϧͰɺGPSLCPNC߈ܸΛͯ͠ɺؼͬͯ͘Δ
None
ΈΜͳίϯςφʹ ͳͬͯΈΑ͏ʁʁʁ
͜͜·Ͱͷ·ͱΊ wίϯςφͨͩͷ ϓϩηεɻා͘ͳ͍Αʂ
ͱ͍͏͜ͱͰ wίϯςφΛܰʙ͘ϋϯυϝΠυͯ͠Έ·͠ΐ͏͔ɻ
ಠཱͨ͠SPPUʹ͍Δ wEFCPPUTUSBQͱݴ͏ίϚϯυͰɺ%FCJBOͷϑΝΠϧγεςϜ͚ͩΛ ४උͰ͖Δɻ wDISPPUͱݴ͏ίϚϯυͰɺͦͷதʹೖΔ͜ͱ͕Ͱ͖·͢ w ࣮%PDLFSͳ͠Ͱɺ6CVOUVͷதͰ%FCJBOڥΛಘΔ͜ͱͰ͖Δ mkdir /root/7th-engineer debootstrap
--variant=minbase \ jessie \ /root/7th-engineer \ http://ftp.jp.debian.org/debian
None
/BNFTQBDFΛ͢Δ wVOTIBSFͱݴ͏ίϚϯυΛ͏ͱͰ͖Δ •unshare --fork --pid --mount --uts wͷΑ͏ʹͯ͠ɺ1*%OBNFTQBDFɺ.PVOU/BNFTQBDFɺ654 /BNFTQBDFΛͰ͖Δ
DHSPVQͷ੍ݶΛ͔͚Δ w৽͍͠DHSPVQɺ NLEJSͳͲͰ؆୯ʹ࡞ΕΔ wࣗΛॴଐͤ͞ΔʹɺUBTLTͱ͍͏ϑΝΠϧʹࣗͷ1*%Λॻ͖ࠐ Ί0,ɻ •echo $$ > /sys/fs/cgroup/cpu/7th-engineer/tasks
Ұ࿈ͷॲཧΛͭͳ͛Δɻॱ൪ҙ mkdir -p /sys/fs/cgroup/cpu/7th-engineer unshare --fork --pid --mount --uts
echo $$ > /sys/fs/cgroup/cpu/7th-engineer/tasks chroot /root/7th-engineer cd / mount -t proc proc /proc hostname 7th-engineer.example bash -l ʮ͓·͡ͳ͍ʯతॲཧΛՃɻ্͔Βೖྗ࣮ͯ͠ߦͯ͠ΈΑ͏
͜Είϯςφʁ wγεςϜ͕%FCJBOͰ͋Δ wϓϩηε͕ಠཱ͍ͯ͠Δ wϗετ໊ҧ͏
ԋशͦͷ w ઌ΄Ͳͷʮࣗ࡞ίϯςφʯʹ͍ͭͯɺ ผͷλʔϛφϧ͔ΒϗετʹೖΓɺҎԼΛ͔֬ΊͯΈΑ͏ɻ w ϗετ͔Βݟͯίϯςφ͕ʮϓϩηεʯͰ͋Δ͜ͱ w
1*%ɺ.PVOUɺ654/BNFTQBDF͕͍ͯ͠Δ͜ͱ w ίϯςφͰ$16Λ͍͘Βͬͯɺϗετͷ$16Λ͔͠ Θͳ͘ͳΔΑ͏ɺDHSPVQΛઃఆͯ͠ΈΑ͏ɻ·ͨɺ֬ೝ͠Α͏ IJOUIUUQTBDDFTTSFEIBUDPNEPDVNFOUBUJPOKB+13FE@)BU@&OUFSQSJTF@-JOVY IUNM
[email protected]
@(VJEFTFDDQVIUNM
·ͱΊ
֮͑ͱ͘͜ͱͭ w-JOVYʹ͓͍ͯɺϓϩηεʹؔ͢Δͨ͘͞Μͷใ͕QSPDͷԼʹ ͋Δ͜ͱ w-JOVYίϯςφɺΧʔωϧͷϦιʔεʮʯͱʮ੍ݶʯͷػೳΛ ͬͨϓϩηεͰ͋Δ͜ͱ
֮͑ͱ͘͜ͱͭ w-JOVYʹ͓͍ͯɺϓϩηεʹؔ͢Δͨ͘͞Μͷใ͕QSPDͷԼʹ ͋Δ͜ͱ w-JOVYίϯςφɺΧʔωϧͷϦιʔεʮʯͱʮ੍ݶʯͷػೳΛ ͬͨϓϩηεͰ͋Δ͜ͱ wͲΜͳʹͦ͠͏ͳπʔϧͰɺ୭͔͕ॻ͍ͨͷͰ͋Γɺ ͦͯ͠044Ͱ͋ΔݶΓதΛਂ͘Δ͜ͱ͕Ͱ͖Δͱ͍͏͜ͱ
ࠓ͞ͳ͔ͬͨ͜ͱ wίϯςφؔ࿈ͷͦͷଞͷػೳͷօ͞Μ wQJWPU@SPPU w,FSOFM$BQBCJMJUZ w3FTPVSDF-JNJU SMJNJU wTFDDPNQ#1' w."$ 4&-JOVY"QQ"SNPS
-JOVY4FDVSJUZ.PEVMFT -4.
͞ΒͳΔਂΈ w͋ͷ!SZΛҭͯͨ ڈͷ࠲ֶࢿྉ wIUUQTTQFBLFSEFDLDPNVE[VSBUIFTLFMUPOPGXIBMFT