次世代のコンテナランタイム!?gVisorのコードを読みながら理解してみる

 次世代のコンテナランタイム!?gVisorのコードを読みながら理解してみる

golang.tokyo

26ae758ababcd94b99c8192dbdd5b8d3?s=128

Koki Ide

May 30, 2018
Tweet

Transcript

  1. 3.

    ࣗݾ঺հ - - 3 Copyright© 2018 Flatt Inc. All rights

    reserved. @niconegoto Ҫख߁و 'MBUU *OD$&0 4UVEFOUPG6OJWFSTJUZPG5PLZP
  2. 6.

    H7JTPSͱ͸Կ͔ - - 6 Copyright© 2018 Flatt Inc. All rights

    reserved. (PPHMFͷج൫ٕज़Ά͍ʜ ࡉ͔͍͜ͱ͸࿦จ͕Λ଴͍͕ͪͨݱ ࣌఺Ͱ൑໌͍ͯ͠Δ෦෼ʹ͍ͭͯࠓ ೔͸ѻ͏ ࣌୅͕΍ͬͱ (PPHMFʹ௥͍ ͍͖͔ͭͯͨ
  3. 7.

    H7JTPSͱ͸Կ͔ - - 7 Copyright© 2018 Flatt Inc. All rights

    reserved. +BWB/PEF༻ͷ৽͍͠("&͸ H7JTPS্Ͱಈ͍͍ͯΔ 7FSNB "CIJTIFL FUBM-BSHFTDBMFDMVTUFS NBOBHFNFOUBU(PPHMFXJUI#PSH1SPDFFEJOHTPG UIF5FOUI&VSPQFBO$POGFSFODFPO$PNQVUFS 4ZTUFNT"$.  #PSHͷ࿦จ΋ͥͻ
  4. 8.

    H7JTPSͱ͸Կ͔ - - 8 Copyright© 2018 Flatt Inc. All rights

    reserved. H7JTPSJTBVTFSTQBDFLFSOFM XSJUUFOJO(P UIBUJNQMFNFOUTB TVCTUBOUJBMQPSUJPOPGUIF-JOVYTZTUFNTVSGBDF*UJODMVEFTBO0QFO $POUBJOFS*OJUJBUJWF 0$* SVOUJNFDBMMFESVOTDUIBUQSPWJEFTBO JTPMBUJPOCPVOEBSZCFUXFFOUIFBQQMJDBUJPOBOEUIFIPTULFSOFM 5IFSVOTDSVOUJNFJOUFHSBUFTXJUI%PDLFSBOE,VCFSOFUFT NBLJOHJU TJNQMFUPSVOTBOECPYFEDPOUBJOFST
  5. 9.

    H7JTPSͱ͸Կ͔ - - 9 Copyright© 2018 Flatt Inc. All rights

    reserved. H7JTPSJTBVTFSTQBDFLFSOFM XSJUUFOJO(P UIBUJNQMFNFOUTB TVCTUBOUJBMQPSUJPOPGUIF-JOVYTZTUFNTVSGBDF*UJODMVEFTBO0QFO $POUBJOFS*OJUJBUJWF 0$* SVOUJNFDBMMFESVOTDUIBUQSPWJEFTBO JTPMBUJPOCPVOEBSZCFUXFFOUIFBQQMJDBUJPOBOEUIFIPTULFSOFM 5IFSVOTDSVOUJNFJOUFHSBUFTXJUI%PDLFSBOE,VCFSOFUFT NBLJOHJU TJNQMFUPSVOTBOECPYFEDPOUBJOFST
  6. 11.

    H7JTPSͱ͸Կ͔ - - 11 Copyright© 2018 Flatt Inc. All rights

    reserved. ϢʔβʔΞϓϦέʔγϣϯ ΦʔέετϨʔγϣϯ LVCFSOFUFT౳ ߴҐϥϯλΠϜ DPOUBJOFSE౳ ௿ҐϥϯλΠϜ SVOD౳ Χʔωϧ 7. ϋʔυ΢ΤΞ ^
  7. 12.

    H7JTPSͱ͸Կ͔ - - 12 Copyright© 2018 Flatt Inc. All rights

    reserved. 0QFO$POUBJOFS*OJUJBUJWF 0$*  %PDLFSΛখ͞ͳ࠶ར༻Մೳͳίϯϙʔωϯτ ʹ෼ղ͢ΔͨΊʹSVOD΍DPOUBJOFSE͕ಋೖ ϗετΧʔωϧͱͷ෼཭ʹΑͬͯSVODΛΑΓ ηΩϡΞʹ࣮ߦͤ͞Α͏ͱ͍ͯ͠Δͷ͕SVOTD
  8. 13.

    H7JTPSͱ͸Կ͔ - - 13 Copyright© 2018 Flatt Inc. All rights

    reserved. ैདྷͷίϯςφٕज़Ͱ͸୯ҰͷϗετΧʔ ωϧΛ࢖༻͢Δ͜ͱʹΑͬͯޮ཰ੑͱύ ϑΥʔϚϯεΛ޲্ͤͨ͞ɻ ҰํͰɺ୯Ұͷ੬ऑੑ͔Βϗετ͕߈ܸ͞ Εͯ͠·͏ͱ͍͏ܽ఺͕ɻ FY
 ϗετͷϑΝΠϧγεςϜΛϚ΢ϯτ͞Εͯ͠·͏όά
 $7&
  9. 15.

    ϗετΧʔωϧͱͷ෼཭ - - 15 Copyright© 2018 Flatt Inc. All rights

    reserved. ओͳख๏͸ͭ H7JTPS w ϚγϯϨϕϧԾ૝Խ .BDIJOFMFWFMWJSUVBMJ[BUJPO  w ϧʔϧʹج࣮ͮ͘ߦ 3VMFCBTFEFYFDVUJPO  w H7JTPS
  10. 16.

    ϗετΧʔωϧͱͷ෼཭ .BDIJOFMFWFMWJSUVBMJ[BUJPO - - 16 Copyright© 2018 Flatt Inc. All

    rights reserved. FY,7.΍9FO Ծ૝ϚγϯϞχλʢ7..ʣΛհͯ͠Ծ ૝Խ͞Εͨϋʔυ΢ΣΞΛήετΧʔ ωϧʹެ։͢Δ ΊͬͪΌ4FDVSF͕ͩΦʔόʔϔου ͕େ͖͍ʜύϑΥʔϚϯεͷ௿Լ
  11. 17.

    ϗετΧʔωϧͱͷ෼཭ 3VMFCBTFEFYFDVUJPO - - 17 Copyright© 2018 Flatt Inc. All

    rights reserved. FYTFDDPNQɺ4&-JOVYɺ"QQ"SNPS ΞϓϦέʔγϣϯ·ͨ͸ίϯςφͷࡉ͔͍ηΩϡ ϦςΟϙϦγʔΛࢦఆͰ͖Δ ͔ͬ͠ΓఆٛͰ͖Ε͹ޮՌత͕ͩɺॳݟͷΞϓϦ έʔγϣϯͰ׬ᘳͳϙϦγʔఆٛΛߦ͏͜ͱ͸࣮ ࣭ෆՄೳͳͷͰ෇Ճతʹ࢖ΘΕΔ
  12. 18.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 18 Copyright© 2018 Flatt Inc. All

    rights reserved. ϢʔβʔۭؒͰήετΧʔωϧͱͯ͠ ػೳ͢Δ 7..ͱಉ༷ʹΞϓϦέʔγϣϯ͸γ εςϜίʔϧΛ௚઀੍ޚෆՄೳ
 3VMFCBTFEFYFDVUJPO΋࢖༻Մೳ
  13. 19.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 19 Copyright© 2018 Flatt Inc. All

    rights reserved. ΞϓϦέʔγϣϯͷγεςϜίʔϧΛΠϯ λʔηϓτ QUSBDF γεςϜίʔϧΛϑΟϧλʔ੍ͯ͠ݶ TFDDPNQ γεςϜίʔϧΛஔ׵ H7JTPS
  14. 20.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 20 Copyright© 2018 Flatt Inc. All

    rights reserved. ίϯςφϥϯλΠϜ΍ΦʔέετϨʔλΛ ඇSPPUͰಈ͔͢ྲྀΕ͸Ҏલ͔Β͋ΓɺSVOD ͸೥͔ΒSPPUMFTTΛ࠾༻͍͕ͯͨ͠ ϢʔβʔۭؒͰͷ࣮ߦ͕Ͱ͖ͳ͔ͬͨ
  15. 21.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 21 Copyright© 2018 Flatt Inc. All

    rights reserved. 4FOUSZϓϩηε͸ήετΧʔωϧΛؚΈɺ TFDDPNQʹΑΔγεςϜίʔϧͷ੍ݶ΍Ϣʔ βίʔυͷ࣮ߦͱγεςϜίʔϧͷॲཧΛ ୲౰ αϯυϘοΫεΛӽ͑ͨϑΝΠϧγες Ϝૢ࡞͸ɺ1 1MBO'JMFTZTUFN 1SPUPDPM ઀ଓΛհͯ͠(PGFSͱݺ͹ΕΔ ϓϩΩγʹૹΓɺ୅ΘΓʹϑΝΠϧૢ࡞ Λߦ͏ H7JTPSίϯςφϥϯλΠϜ͸ͭͷผʑͷϓϩηεʹ෼ׂ͞ΕΔ
  16. 22.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 22 Copyright© 2018 Flatt Inc. All

    rights reserved. ΞϓϦέʔγϣϯʹ୅ΘͬͯϗετϑΝΠϧΛ։͖ɺ ϗετϑΝΠϧΞΫηεࣗମΛ࣋ͨͳ͍4FOUSZϓϩ ηεʹ౉͢͜ͱʹΑͬͯɺϑΝΠϧγεςϜͷϓϩΩ γͱͯ͠ػೳ
 (PGFS 4FOUSZ͸ۭͷϢʔβʔۭؒͰ࣮ߦ͞ΕɺH7JTPSʹ ΑͬͯߦΘΕͨγεςϜίʔϧ͸TFDDPNQϑΟϧ λΛ࢖༻ͯ͠ݫ֨ʹ੍ݶ͞ΕΔ
  17. 23.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 23 Copyright© 2018 Flatt Inc. All

    rights reserved. 4FOUSZ͸ɺجຊతͳίϯςΩετεΠο νͱϝϞϦϚοϐϯάػೳΛ࣮૷͢Δ ϓϥοτϑΥʔϜΛඞཁͱ͍ͯͯ͠ɺ ݱࡏ͸1USBDFͱ,7.Λαϙʔτ ,7. ͸ࢼݧత 4FOUSZ
  18. 24.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 24 Copyright© 2018 Flatt Inc. All

    rights reserved. ɾ1USBDFϓϥοτϑΥʔϜ͸ɺ153"$&@4:4&.6 Λ࢖༻ͯ͠ɺϗετγεςϜίʔϧΛ࣮ߦͤͣʹϢʔ βʔίʔυΛ࣮ߦ ɾQUSBDF͕ಈ࡞͢Δ೚ҙͷ৔ॴͰ࣮ߦՄೳ ɾQUSBDFͷύϑΥʔϚϯε͕͋͋͋͋͋͋ 4FOUSZ
  19. 25.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 25 Copyright© 2018 Flatt Inc. All

    rights reserved. ɾ,7.ϓϥοτϑΥʔϜʹΑͬͯ4FOUSZ͸ήετ04 ͱ7.. 7JSUVBM.BDIJOF.POJUPS ͷ྆ํͱͯ͠ػ ೳ͠ɺͦΕΒΛγʔϜϨεʹ੾Γସ͑Δ͜ͱ͕Մೳ ɾ࠷৽ͷϓϩηοαͰ࢖༻Ͱ͖ΔԾ૝Խ֦ுػೳ Λ׆༻͢Δ͜ͱʹΑͬͯɺΞυϨεۭؒεΠον ͷ෼཭ੑͱύϑΥʔϚϯεΛ޲্ 4FOUSZ
  20. 26.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 26 Copyright© 2018 Flatt Inc. All

    rights reserved. 4FOUSZ͸(PͰ࣮૷͞ΕͨOFUTUBDLͱ͍͏ಠࣗͷωοτϫʔΫελο ΫΛ࣮૷͍ͯ͠Δ ωοτϫʔΫΞΫηε HJUIVCDPNHPPHMFOFUTUBDL ωοτϫʔΫελοΫ 5$1ͷ઀ଓঢ়ଶɺ੍ޚϝοηʔδɺύέοτ ΞηϯϒϦͳͲ ͸શͯ4FOUSZ಺෦Ͱॲཧ͞Εɺϗετͷωοτϫʔ ΫελοΫ͔Βִ཭͞ΕΔ σʔλϦϯΫ૚ͷύέοτ͸ɺ%PDLFS·ͨ͸,VCFSOFUFTʹΑͬͯ ઃఆ͞ΕͨωʔϜεϖʔε಺ͷԾ૝σόΠεʹ௚઀ॻ͖ࠐ·ΕΔ
  21. 27.

    ϗετΧʔωϧͱͷ෼཭ H7JTPS - - 27 Copyright© 2018 Flatt Inc. All

    rights reserved. ैདྷͷϋʔυ΢ΣΞ΋Ծ૝Խ͢Δ४Ծ૝ԽΑΓ͸ܰྔͩ͠ɺ γεςϜίʔϧͷ࢖༻Λېࢭ͢ΔΑΓ͸޿͍΋ͷΛಈ͔ͤΔ H7JTPS͸QUSBDF͕ϘτϧωοΫͱͳΓγεςϜίʔϧͷෛՙͷ େ͖͍ϫʔΫϩʔυͷύϑΥʔϚϯε͕௿Լ͢ΔՄೳੑ͕͋Δ ؆୯ͳ·ͱΊ ϝϞϦͱܕ҆શͷͨΊʹ໿ສߦͷ(PͰ࣮૷͞Ε͍ͯΔʜʂʂʂ
  22. 29.

    ίʔυΛܰ͘ಡΜͰΈΔ - - 29 Copyright© 2018 Flatt Inc. All rights

    reserved. ΞϓϦέʔγϣϯͷγεςϜίʔϧΛΠϯ λʔηϓτ QUSBDF γεςϜίʔϧΛϑΟϧλʔ੍ͯ͠ݶ TFDDPNQ γεςϜίʔϧΛஔ׵ H7JTPS
  23. 30.

    - - 30 Copyright© 2018 Flatt Inc. All rights reserved.

    ίʔυΛܰ͘ಡΜͰΈΔ IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZLFSOFMUBTL@SVOHP
  24. 31.

    - - 31 Copyright© 2018 Flatt Inc. All rights reserved.

    HJUIVCDPNHPPHMFHWJTPSQLHTFOUSZ ίʔυΛܰ͘ಡΜͰΈΔ 4FOUSZʹؔ͢Δ࣮૷͕·ͱ·͍ͬͯΔ ॏ͍
  25. 32.

    - - 32 Copyright© 2018 Flatt Inc. All rights reserved.

    ίʔυΛܰ͘ಡΜͰΈΔ IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZLFSOFMUBTL@SVOHP UBTL3VO4UBUFFYFDVUF͕OJMΛฦͨ͠ ৔߹ɺλεΫͷHPSPVUJOF͸ఀࢭΛ֬ ೝͤͣʹऴྃͤ͞Δ
  26. 33.

    - - 33 Copyright© 2018 Flatt Inc. All rights reserved.

    ίʔυΛܰ͘ಡΜͰΈΔ IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZLFSOFMUBTL@SVOHP
  27. 34.

    - - 34 Copyright© 2018 Flatt Inc. All rights reserved.

    ίʔυΛܰ͘ಡΜͰΈΔ IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZLFSOFMUBTL@TZTDBMMHP
  28. 35.

    - - 35 Copyright© 2018 Flatt Inc. All rights reserved.

    IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZLFSOFMTFDDPNQHP- ίʔυΛܰ͘ಡΜͰΈΔ
  29. 36.

    - - 36 Copyright© 2018 Flatt Inc. All rights reserved.

    HJUIVCDPNHPPHMFHWJTPSQLHTFOUSZGT ίʔυΛܰ͘ಡΜͰΈΔ -JOVYԾ૝ϑΝΠϧγεςϜͷ࣮૷
  30. 37.

    - - 37 Copyright© 2018 Flatt Inc. All rights reserved.

    IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZGTJOPEFHP ίʔυΛܰ͘ಡΜͰΈΔ *OPEF
 ϑΝΠϧγεςϜ্ͷϑΝΠϧͷ ΩϟογϡϏϡʔʢϝλσʔλͱ ϖʔδΩϟογϡΛؚΉʣΛอ࣋ ͢ΔԾ૝ϑΝΠϧΦϒδΣΫτ
  31. 38.

    - - 38 Copyright© 2018 Flatt Inc. All rights reserved.

    IUUQTHJUIVCDPNHPPHMFHWJTPSQLHTFOUSZGTEJSFOUHP-d ίʔυΛܰ͘ಡΜͰΈΔ %JSFOU
 ϝϞϦ಺ͷGT*OPEFΛ7'4಺ͷύ εʹΩϟογϡ͠ɺGT*OPEFʹ ଞͷGT*OPEFʹରͯ͠૬ରҐஔΛ ༩͑Δ
  32. 39.

    - - 39 Copyright© 2018 Flatt Inc. All rights reserved.

    ίʔυΛܰ͘ಡΜͰΈΔ GT'JMFGT%JSFOUGT*OPEFGT.PVOUFE'JMFTZTUFN ϑΝΠϧΛΦʔϓϯ͢ΔࡍɺGT'JMF͸ϑΝΠϧγεςϜΦϒδΣΫτΛҎԼͷ༷ʹࢀর
  33. 40.

    - - 40 Copyright© 2018 Flatt Inc. All rights reserved.

    ίʔυΛܰ͘ಡΜͰΈΔ ॏ͍Ͱ͕͢ ͥͻօ͞Μ΋ಡΜͰΈ͍ͯͩ͘͞
  34. 41.
  35. 42.

    ࣗݾ঺հ - - 42 Copyright© 2018 Flatt Inc. All rights

    reserved. @niconegoto Ҫख߁و 'MBUU *OD$&0 4UVEFOUPG6OJWFSTJUZPG5PLZP