Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Write Container Runtime in Go
Search
tomocy
October 28, 2019
Programming
4
3.1k
Write Container Runtime in Go
Presented in Go Conference 2019 Autumn
https://gocon.jp/sessions/write_container_runtime_in_go/
tomocy
October 28, 2019
Tweet
Share
More Decks by tomocy
See All by tomocy
Work around Dart custom lint rule
tomocy
1
420
Other Decks in Programming
See All in Programming
新規学習のハードルを下げる方法とは?/ How to Make Learning Something New Easier?
nobuoooo
1
130
我々のデザインシステムは Chakra v3 にアップデートします
shunya078
2
2.9k
React への依存を最小にするフロントエンド設計
takonda
21
8.8k
PipeCDの歩き方
kuro_kurorrr
4
140
型のインスタンス化は非常に深く、無限である可能性があります。
kimitashoichi
0
140
アニメーションを最深まで理解してパフォーマンスを向上させる
mine2424
0
110
Symfony Mapper Component
soyuka
2
530
Remix on Hono on Cloudflare Workers
yusukebe
2
400
14 Years of iOS: Lessons and Key Points
seyfoyun
1
650
Missing parts when designing and implementing Android UI
ericksli
0
390
イマのCSSでできる インタラクション最前線 + CSS最新情報
clockmaker
5
3.8k
CSC305 Lecture 25
javiergs
PRO
0
110
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
Building Applications with DynamoDB
mza
91
6.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Docker and Python
trallard
41
3.1k
Navigating Team Friction
lara
183
15k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
How GitHub (no longer) Works
holman
310
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Faster Mobile Websites
deanohume
305
30k
Code Review Best Practice
trishagee
64
17k
Become a Pro
speakerdeck
PRO
25
5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
1
100
Transcript
Write Container Runtime in Go Go Conference 2019 Autumn Koki
Tomoshige (@towocy)
Write Container Runtime in Go
Write Container Runtime in Go
ίϯςφϥϯλΠϜʹ͍ͭͯ
ίϯςφٕज़ ίϯςφϥϯλΠϜͱ ίϯςφΠϝʔδ
ίϯςφϥϯλΠϜ OCI runtimeʹ४ڌ͍ͯ͠Δ
OCIʢOpen Container Initiativeʣ ίϯςφٕज़ͷඪ४ن֨Λ ࡞͢ΔͨΊͷஂମ
None
runtime.me ίϯςφϥϯλΠϜͱͯ͠ͷ ঢ়ଶͱৼΔ͍ https://github.com/opencontainers/runtime-spec/blob/master/runtime.md
Query State state <container-id> Create create <container-id> <path-to-bundle> Start start
<container-id> Kill kill <container-id> <signal> Delete delete <container-id>
None
Standard Go Project Layout /cmd https://github.com/golang-standards/project-layout#cmd
None
CLI pkg github.com/urfave/cli
None
None
None
None
None
InterfaceͰͷநԽ ༻ऀଆ͕ ٻΊΔৼΔ͍Λఆٛ͢Δ https://github.com/golang/go/wiki/CodeReviewComments#interfaces
None
ίϯςφϥϯλΠϜͷ࣮ʹ͍ͭͯ
ίϯςφϥϯλΠϜ ϗετOS্ͷ Ϧιʔεִ͕ɺ੍ݶ͞Εͨϓϩηε
‘Contain’er ʙΛด͡ࠐΊΔ
ίϯςφϥϯλΠϜ How to contain a process
https://employment.en-japan.com/engineerhub/entry/2019/02/05/103000#ίϯςφͱ ΧʔωϧϦιʔεɺϑΝΠϧγεςϜͷִ Namespaceɺchroot/pivot_root ϋʔυΣΞϦιʔεͷ੍ݶ cgroup ݖݶͷ੍ Capabilityɺseccomp
None
Fork
Fork ϓϩηε ࢠϓϩηε
Fork ϓϩηε ࢠϓϩηε Contain
None
Build Constraints ϑΝΠϧ໊Ͱ ϏϧυରΛ͚Δ https://golang.org/pkg/go/build/#hdr-Build_Constraints
None
None
None
None
Fork ϓϩηε ࢠϓϩηε Contain
https://github.com/rrreeeyyy/container-internship/tree/master/02#linux-namespaces IPC ϓϩηεؒ௨৴Ͱ͏Ϧιʔε Network ωοτϫʔΫσόΠεɺϧʔςΟϯάςʔϒϧ Mount ϑΝΠϧγεςϜπϦʔ PID ϓϩηε ID
User Ϣʔβ IDɺάϧʔϓ ID UTS nodenameɺdomainname
None
Fork
None
Filesystem bundle config.jsonͱrootfs https://github.com/opencontainers/runtime-spec/blob/master/bundle.md
ࢠϓϩηεͷϧʔτ༻ʹ
ࢠϓϩηεͷϧʔτ༻ʹ mount͍ͯ͘͠
ࢠϓϩηεͷϧʔτ༻ʹ mount͍͖ͯ͠ ͦͯ͠pivot_root͢Δ
ࢠϓϩηεʹ / ʹݟ͑Δ
cgroup ϓϩηεʹରͯ͠ ڞ௨ͷϦιʔεཧΛ͢Δ https://gihyo.jp/admin/serial/01/linux_containers/0003
None
None
None
None
None
None
None
None
None
None
None
None
Write Container Runtime in Go
͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ
https://github.com/opencontainers/runtime-spec/blob/master/runtime.md https://github.com/opencontainers/runtime-spec/blob/master/bundle.md https://github.com/golang-standards/project-layout#cmd https://github.com/golang/go/wiki/CodeReviewComments#interfaces https://employment.en-japan.com/engineerhub/entry/2019/02/05/103000#ίϯςφͱ https://golang.org/pkg/go/build/#hdr-Build_Constraints https://github.com/rrreeeyyy/container-internship/tree/master/02#linux-namespaces https://employment.en-japan.com/engineerhub/entry/2019/02/05/103000 https://github.com/tomocy/gocon ࢀߟจݙ
https://speakerdeck.com/kyohmizu/windowskontenaru-men?slide=26 https://speakerdeck.com/tenforward/cndt2019 https://sil.hatenablog.com/entry/why-container-is-secure