Slide 1

Slide 1 text

γεςϜίϯςφ޲͚Τϯδϯ LXC/LXD ͷ͝঺հ JapanContainerDays v18.12 Meetup Ճ౻ହจʢ@ten_forwardʣ 2018-12-03

Slide 2

Slide 2 text

ࣗݾ঺հ Ճ౻ହจ • https://www.ten-forward.ws/ • @ten_forwardʢTwitterʣ • https://github.com/tenforward/ • https://tenforward.hatenablog.com/ ʢٕज़ϒϩάʣ 1/12

Slide 3

Slide 3 text

ࣗݾ঺հʢ͓࢓ࣄʣ ϑΝʔεταʔόɹ։ൃ෦ɹॴଐ 2/12

Slide 4

Slide 4 text

ࣗݾ঺հʢίϯςφํ໘ʣ • 10 ೥΄Ͳલ͔Βίϯςφؔ࿈ͷ։ൃ΍ػೳௐࠪΛߦ͏ • ΦʔέετϨʔγϣϯΑΓΧʔωϧدΓʹڵຯ͕͋Δɺίϯςφͷྲྀߦʹ৐Γ஗Ε ͨίϯςφΤϯδχΞ • LXC ͰֶͿίϯςφೖ໳ɹʔܰྔԾ૝Խ؀ڥΛ࣮ݱ͢Δٕज़ʢgihyo.jpʣ • ίϯςφܕԾ૝Խͷ৘ใަ׵ձओ࠻ ʢhttps://sites.google.com/site/containerstudy/ʣ 3/12

Slide 5

Slide 5 text

linuxcontainers.org • ʮγεςϜίϯςφʯʹϑΥʔΧεΛ౰ͯɺؔ࿈͢ΔϓϩμΫτͷ։ൃΛߦ͏ϓϩ δΣΫτ • ։ൃͷத৺ͱͳΔΤϯδχΞ͸ Canonical/Ubuntu ํ໘ͷΤϯδχΞ • ϓϩμΫτ • LXC • LXD • LXCFS cgroup Λ࢖͍ proc ҎԼͷϑΝΠϧʹίϯςφ޲͚Ϧιʔε৘ใΛఏڙ • Ubuntu ͷ LTS ϦϦʔεʹ߹ΘͤͯϝδϟʔόʔδϣϯΞοϓʢݱࡏ͍ͣΕ΋ 3.xʣ 4/12

Slide 6

Slide 6 text

LXC • ΋ͱ΋ͱ͸ Linux Χʔωϧʹ࣮૷͕ਐΉ֤छίϯςφؔ࿈ػೳΛ։ൃऀ͕ࢼͨ͢ Ίʹ࡞ΒΕͨ • ୯Ұϗετ্ͷίϯςφΛѻ͏ͨΊͷϥΠϒϥϦʢliblxcʣͱπʔϧ܈ • ֤छݴޠ͔Β࢖͏ͨΊͷόΠϯσΟϯάʢgolangɺpythonɺrubyɺluaʣ • 0.9 Ҏલ͸ Docker ͸ཪͰ LXC ͷίϚϯυΛݺͼग़͍ͯͨ͠ʢ౰࣌ͷ LXC ͸ ϥΠϒϥϦԽ͞Ε͍ͯͳ͔ͬͨʣ # ps axf : (snip) 1363 pts/2 Ssl+ 0:15 /usr/local/bin/docker -d 3661 pts/4 Ss 0:00 \_ lxc-start -n 2bca4c0732612be32fcb978c48c260c37a9b494cf37a6844f0ddefb2d4441ca1 -f /var/lib/doc 3665 pts/4 S+ 0:00 \_ /bin/bash 5/12

Slide 7

Slide 7 text

LXD • ωοτϫʔΫ্ͷίϯςφϗετͱ LXC ίϯςφΛ؅ཧ͢Δ • UNIX ιέοτ or ωοτϫʔΫܦ༝Ͱ REST API ΛఏڙʢίϚϯυϥΠϯΫϥ ΠΞϯτ͕ଘࡏ͢Δʣ • Go όΠϯσΟϯάܦ༝Ͱ liblxc Λ࢖༻ʢLXC ͷॻ͖௚͠Ͱ͸ͳ͍ʣ • ຊ֨తͳ IaaS ؀ڥ޲͚ʹ͸ OpenStack ޲͚ͷυϥΠό͕ଘࡏ OpenStack Ͱͷར༻͸͜ͷ͋ͱͷηογϣϯʮOpenStack ʹΑΔ LXD ίϯς φ׆༻ೖ໳ʯΛͲ͏ͧʂ 6/12

Slide 8

Slide 8 text

LXD ͷػೳ • ΠϝʔδϕʔεʢUbuntu ΍֤छσΟετϦϏϡʔγϣϯͷΠϝʔδ͕४උ͞Ε ͍ͯΔʣ • جຊ͸ඇಛݖίϯςφʢಛݖίϯςφ΋Մೳʣ • ϓϩϑΝΠϧʢίϯςφͷߏ੒΍ɺ͋ΒΏΔઃఆΛϓϩϑΝΠϧͱͯ͠อ࣋͠ɺί ϯςφʹద༻Մೳʣ • ʢྫʣEC2 ෩ͷΠϯελϯελΠϓͰίϯςφ࡞੒Մೳ ʢlxc launch ubuntu:18.04 ct01 -t t2.microʣ • ωετʢίϯςφ in ίϯςφʣՄೳ • ؆қతͳΫϥελϦϯάػೳʢશ LXD ϊʔυͰ DB Λಉظʣ • CRIU Λ࢖ͬͨϥΠϒϚΠάϨʔγϣϯ ʢCRIU ͸ 12/5 ޕޙʹηογϣϯ͕͋Γ·͢Ͷʂ ʣ • cloud-init αϙʔτ • ༷ʑͳετϨʔδʢϑΝΠϧγεςϜʣʹରԠ͠ɺͦΕͧΕͷػೳʹԠͨ͡ૢ࡞͕ Մೳ 7/12

Slide 9

Slide 9 text

LXC/LXD Λ࢖͏ཧ༝ • γεςϜίϯςφ ˠੈͷதΞϓϦέʔγϣϯίϯςφͰຬͨ͞ΕΔཁ݅͹͔ΓͰ͸ͳ͍Ͱ͢ΑͶ? ܰ ྔͳԾ૝ϗετ؀ڥͱͯ͠ • ΦϑΟγϟϧͳ೔ຊޠυΩϡϝϯτ͕ଗ͍ͬͯΔ ˠ linuxcontainers.org Ͱ΄΅׬ᘳʹ຋༁͞Ε͍ͯΔͷ͸೔ຊޠ͚ͩ!! • Linux Χʔωϧʹଟ਺࣮૷͞Ε͍ͯΔίϯςφؔ࿈ػೳΛ࢖ͬͯΈ͍ͨ! ˠ LXC ͸ΧʔωϧͷػೳΛϑϧʹ࣮૷ͯ͠࡞ΒΕ͍ͯΔ 8/12

Slide 10

Slide 10 text

LXD Λࢼ͢ʹ͸ Πϯετʔϧ͢ΒෆཁͰ͢!! • ެࣜϖʔδ͔ΒΦϯϥΠϯͰࢼ༻Մೳ!! • ΋ͪΖΜ Ubuntu Server ؀ڥΛ४උ͢Ε͹σϑΥϧτͰىಈ͍ͯ͠·͢ 9/12

Slide 11

Slide 11 text

LXD Λࢼ͢ʹ͸ 1. ʢUbuntu Server ؀ڥͷ৔߹ʣlxd σʔϞϯͷॳظԽ $ sudo lxd init ʢ࣭໰ʹ౴͑Δʣ ʢΦϯϥΠϯ؀ڥͷ৔߹͸ෆཁʣ 2. ίϯςφͷىಈ $ lxc launch ubuntu:18.04 10/12

Slide 12

Slide 12 text

·ͱΊ • ܰྔͳԾ૝ϗετ؀ڥʢγεςϜίϯςφʣ͕ඞཁͳ৔߹ɺੋඇ LXC/LXD ͷ࢖ ༻Λߟ͑ͯΈ͍ͯͩ͘͞ʂ • LXC/LXD ؔ܎ͷ຋༁Λ͓ख఻͍͍͚ͨͩΔํืूதͰ͢ 11/12

Slide 13

Slide 13 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 12/12