今からでも遅くない!アプリケーションエンジニアが知っておきたい、Dockerコンテナの基礎知識 / The Basic of Docker Container for Developers
by
Kohei Ota
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ࠓ͔ΒͰ͘ͳ͍ʂ ΞϓϦέʔγϣϯΤϯδχΞ͕͓͖ͬͯͨ ͍%PDLFSίϯςφͷجૅࣝ $MPVE/BUJWF%BZT5PLZP!ދϊώϧζϑΥʔϥϜ גࣜձࣾ;0;0ςΫϊϩδʔζ ։ൃ෦ .-0QTνʔϜ ଠా ߤฏ $PQZSJHIU;0;05FDIOPMPHJFT *OD
Slide 2
Slide 2 text
;0;05FDIOPMPHJFT *OD גࣜձࣾ;0;0ςΫϊϩδʔζ ։ൃ෦ .-0QTνʔϜ ΤϯδχΞ ଠా ߤฏ ݄ʹελʔττΡσΠςΫϊϩδʔζ ݱ;0;0ςΫϊ ϩδʔζ ʹೖࣾɻ ։ൃ෦ͷ1#νʔϜʹͯ"84Λத৺ʹւ֎͚ࣗࣾ&$ͷΠϯϑ ϥ։ൃӡ༻ͳͲΛ୲ޙɺ43&ͱ֤ͯ͠ॴͷΠϯϑϥʹैࣄɻ ݄ΑΓɺ.-0QTνʔϜʹଐͱͳΓɺओʹ($1Λͬ ͨػցֶशج൫ͷઃܭߏஙӡ༻ͳͲΛߦ͍ͬͯΔɻ 2
Slide 3
Slide 3 text
;0;05FDIOPMPHJFT *OD IUUQT[P[PKQ ˔ ຊ࠷େڃͷϑΝογϣϯ௨ൢαΠτ ˔ Ҏ্ͷγϣοϓɺ Ҏ্ͷϒϥϯυͷऔΓѻ͍ʢͱ ʹ݄࣌ʣ ˔ ৗ࣌ສҎ্ͷΞΠςϜͱຖฏۉ Ҏ্ͷ৽ண Λܝࡌ ˔ ଈૹαʔϏε ˔ ΪϑτϥοϐϯάαʔϏε ˔ πέ͍ ͳͲ 3
Slide 4
Slide 4 text
;0;05FDIOPMPHJFT *OD IUUQTXFBSKQ 4 ˔ ຊ࠷େڃͷϑΝογϣϯίʔσΟωʔτΞϓϦ ˔ ສμϯϩʔυಥഁɺίʔσΟωʔτߘ૯ສ݅ Ҏ্ʢͱʹ݄࣌ʣ ˔ શੈքʢ"QQ4UPSF(PPHMF1MBZ͕ར༻ՄೳͳશͯͷࠃʣͰμ ϯϩʔυ͕Մೳ ˔ ສਓҎ্ͷϑΥϩϫʔΛ࣋ͭϢʔβʔʢ8&"3*45"ʣੜ
Slide 5
Slide 5 text
;0;05FDIOPMPHJFT *OD IUUQT[P[PKQNVMUJTJ[F ˔ ͱମॏΛબ͢Δ͚ͩͰཧͷαΠζͷ͕ݟ͔ͭΔ৽͠ ͍༸ͷങ͍ํ ˔ ;0;046*5Ͱಘͨສ݅Ҏ্ͷମܕσʔλΛ׆༻͠ɺʙ αΠζͷϚϧναΠζʢଟαΠζʣʹల։ ˔ ळౙΞΠςϜ͔ΒɺਓؾϒϥϯυͷϚϧναΠζΞΠς ϜΛൢച։࢝ ʲࢀՃاۀʳ גࣜձࣾΞʔόϯϦαʔνɺגࣜձࣾετϥΠϓΠϯλʔφγϣφϧɺ גࣜձࣾσΠτφɾΠϯλʔφγϣφϧɺגࣜձࣾύϧɺגࣜձࣾϏʔϜεɺ גࣜձࣾϕΠΫϧʔζɺ."3,45:-&3גࣜձࣾɺϦʔόΠɾετϥε δϟύϯגࣜձࣾ ͳͲ 5
Slide 6
Slide 6 text
;0;05FDIOPMPHJFT *OD ͜ͷεϥΠυʹॻ͔Ε͍ͯΔ༰ൃදऀݸਓͷͷͰ͋ Γɺ৫ϓϩμΫτΛද͢ΔͷͰ͋Γ·ͤΜɻ ໔ࣄ߲ 6
Slide 7
Slide 7 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφɾΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 7
Slide 8
Slide 8 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφɾΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 8
Slide 9
Slide 9 text
;0;05FDIOPMPHJFT *OD ˔EPU$MPVEࣾ %PDLFSࣾͷલ ͕ࣗࣾͷ1BB4 1MBUGPSN BTB4FSWJDF Λ࡞ΔͨΊʹ։ൃͨ͠ίϯςφܕԾԽ ͷΞϓϦέʔγϣϯ࣮ߦج൫ ˔طଘͷ7.ܕԾԽʹൺɺىಈ͕ඇৗʹߴ ˔ϩΰ͕͔Θ͍͍ %PDLFSͷ͓͞Β͍ 9
Slide 10
Slide 10 text
;0;05FDIOPMPHJFT *OD ˔ίϯςφܕԾԽʁ ˓ίϯςφͱ ˙ΞϓϦέʔγϣϯͷ࣮ߦʹඞཁͳڥΛ Ұͭͷύοέʔδʹ·ͱΊͨԾతͳ୯Ґ ˔04ΑΓԼͷϨΠϠΛʮ-JOVYΧʔωϧʯΛͬͯ ࠶ݱ͢ΔԾԽٕज़ %PDLFSͷ͓͞Β͍ 10 (Go/Java/Ruby...)
Slide 11
Slide 11 text
;0;05FDIOPMPHJFT *OD -JOVY,FSOFM %PDLFS&OHJOF JT ! 11
Slide 12
Slide 12 text
;0;05FDIOPMPHJFT *OD Ͱ͜ͷઆ໌ɺΞϓϦέʔγϣϯ ։ൃऀʹͱͬͯগ͔͠Γʹ͘ ͘ͳ͍Ͱ͔͢ʁ 12
Slide 13
Slide 13 text
;0;05FDIOPMPHJFT *OD ˔खݩ 8JOEPXTNBD04 ͱຊ൪ڥͷࠩҟΛͳ͍ͨ͘͠ ˓αʔόʔ͝ͱʹΞϓϦέʔγϣϯϛυϧΣΞΛ ઃఆɾσϓϩΠ͢Δͷ͕େม ˓ϥΠϒϥϦͷΞοϓσʔτɾɾɾ ˓खݩͷ7BHSBOU "OTJCMF ͱຊ൪ͰϛυϧΣΞͷ όʔδϣϯ͕͏·͘ଗ͑ΒΕͳ͍ʂ %PDLFSར༻͖͢ྫͷ࣮ଶ 13
Slide 14
Slide 14 text
;0;05FDIOPMPHJFT *OD ͦΕɺશ෦ʢجຊతʹʣ %PDLFSͰղܾͰ͖·͢Αʂ 14
Slide 15
Slide 15 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 15
Slide 16
Slide 16 text
;0;05FDIOPMPHJFT *OD ˔%PDLFS্Ͱʮ͜͏͍͏ৼΔ͍Λ͢Δʯͱ͍͏ఆٛ ˔%PDLFSGJMFΛॻ͘ˠϏϧυ͢Δ %PDLFSΠϝʔδ ˓࣮ଶUBSܗࣜͰ·ͱΊͨΞʔΧΠϒϑΝΠϧ ˔͜ͷ࣌Ͱ·࣮ͩࡍʹಈ࡞͍ͯ͠ΔΘ͚Ͱͳ͍ %PDLFSΠϝʔδͱ 16 Dockerfile docker build Docker
Slide 17
Slide 17 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSϗετͷ্Ͱ࣮ࡍʹಈ࡞͢Δϓϩηε ˔ίϯςφΛ্ཱͪ͛ΔͨΊʹɺϕʔεͱͳΔ %PDLFSΠϝʔδ͕ඞཁ %PDLFSίϯςφͱ 17 Docker Docker Docker Docker docker run
Slide 18
Slide 18 text
;0;05FDIOPMPHJFT *OD ˔ݴ͍͑ΔͱɺԼهΛ࣮ߦͨ͠ͷ͕ίϯςφʹͳΔ ˓%PDLFSGJMF͔Β࡞ͨ͠खݩͷΠϝʔδ ˓࡞ࡁΈͷ֎෦ΠϝʔδΛϨδετϦ͔Βऔಘ %PDLFSίϯςφͱ 18 Docker Docker Docker Docker docker run
Slide 19
Slide 19 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSGJMF͔ΒΠϝʔδΛϏϧυ ˔Ϗϧυͨ͠ΠϝʔδΛϨδετϦʹ1VTI ˔ಈ͔͍ͨ͠ڥͰΠϝʔδΛ1VMM͠ɺίϯςφΛىಈ ˔͜ͷྲྀΕΛ·ͱΊͯʮ#VJME 4IBSF 3VOʯͱݺͿ #VJME 4IBSF 3VO 19 Dockerfile docker build Docker Docker docker run
Slide 20
Slide 20 text
;0;05FDIOPMPHJFT *OD %PDLFSΠϝʔδ͕ͦͷ·· ʮΰʔϧσϯΠϝʔδʯͱͳΔͨΊɺ ϥΠϒϥϦݴޠϥϯλΠϜͷ όʔδϣϯࠩҟ͕ੜ·Εʹ͍͘ 20
Slide 21
Slide 21 text
;0;05FDIOPMPHJFT *OD %PDLFSGJMFΛ(JUͰཧ͠ɺΠϝʔδ ͷλάཧʹ(JUϋογϡΛ͏ ͜ͱͰʮ͍ͭʯʮͲͷΠϝʔδʯΛ ͔ͬͨΛ໌֬ʹͰ͖Δ 21
Slide 22
Slide 22 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 22
Slide 23
Slide 23 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͰղܾͰ͖Δ͜ͱ ˓શڥͷڞ௨Խ ˙ΫϥυɾΦϯϓϨ্ͱ։ൃڥͱͷࠩҟΛzݮΒ͢z ˓ߴͳΞϓϦέʔγϣϯ৴ɾσϓϩΠ ˓$*ͳͲʹΑΔࣗಈԽਪਐ ˙ςετಉҰڥͰ࣮ߦՄ %PDLFSۜͷؙͰͳ͍ 23
Slide 24
Slide 24 text
;0;05FDIOPMPHJFT *OD ˔%PDLFS͕ۤखͳ͜ͱ ˓ϞϊϦγοΫͳΞϓϦέʔγϣϯͷཧ ˠ5IF5XFMWF'BDUPS"QQ ˠ$MPVE/BUJWF5SBJM.BQ %PDLFSۜͷؙͰͳ͍ 24
Slide 25
Slide 25 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͰղܾͰ͖ͳ͍͜ͱ ˓ΞϓϦɾγεςϜϩάͷཧ ˓ࢹ ˓ॊೈͳϦιʔεཧ %PDLFSۜͷؙͰͳ͍ 25
Slide 26
Slide 26 text
;0;05FDIOPMPHJFT *OD ίϯςφΛຊ൪ڥͰ ಈ͔͢ʹ͍͔ͭ͘ͷ՝͕͋Δ 26
Slide 27
Slide 27 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 27
Slide 28
Slide 28 text
;0;05FDIOPMPHJFT *OD ˔ຊ൪ڥͰෳͷίϯςφΛಈ͔͢͜ͱ͕Ұൠత ˓Մ༻ੑোੑΛ্͛ΔͨΊ ˓ࣗಈεέʔϦϯάɺϩʔυόϥϯγϯάɺࣗݾ෮چʑ ˔֤ίϯςφಠཱ͓ͯ͠Γɺ͓ޓ͍Λೝࣝ͠ͳ͍ͨΊ ԿΒ͔ͷཧϨΠϠ͕ඞཁʹͳΔ ˠΦʔέετϨʔγϣϯπʔϧΛೖΕΔ ΦʔέετϨʔγϣϯʁʁ 28
Slide 29
Slide 29 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSίϯςφΞϓϦέʔγϣϯ։ൃʹ͓͍ͯ ैདྷ՝ͱͳ͍͍͔ͬͯͨͭ͘ͷΛղফͯ͘͠ΕΔ ˔%PDLFS୯ମͰຊ൪ӡ༻ʹඞཁͳཧ༻ͷػೳ͕ෆ ͍ͯ͠ΔͨΊɺಋೖʹ͕͋Δ ˔ͦΕΒΛղܾ͢ΔʹɺίϯςφΦʔέετϨʔγϣ ϯ͕ඞཁ ͜͜·Ͱͷ·ͱΊ 29
Slide 30
Slide 30 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 30
Slide 31
Slide 31 text
;0;05FDIOPMPHJFT *OD ˔,VCFSOFUFTίϯςφΦʔέετϨʔγϣϯπʔϧͷ ʮσϑΝΫτελϯμʔυʯ ,VCFSOFUFTʁ 31
Slide 32
Slide 32 text
;0;05FDIOPMPHJFT *OD 32
Slide 33
Slide 33 text
;0;05FDIOPMPHJFT *OD ˔ίϯςφ 1PE Λத৺ͱͨ͠ࢄγεςϜ ˓ϫʔΫϩʔυ͕ৗʹʮ͋Δ͖ঢ়ଶʯΛอͭΑ͏ಈ͘ ,VCFSOFUFTͷ֓ཁ 33 Ref: https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/
Slide 34
Slide 34 text
;0;05FDIOPMPHJFT *OD :".-ʹΑΔߏཧ 34
Slide 35
Slide 35 text
;0;05FDIOPMPHJFT *OD ˔ίϯςφͷઃఆ ˓ϕʔεΠϝʔδɺόʔδϣϯɺϙʔτ ˔ཁٻ͢Δ$16ϝϞϦͳͲͷϦιʔε ˔ϔϧενΣοΫ ˔ڥม ˔ࣗಈεέʔϧͷεέʔϧΠϯΞτͷ݅ :".-ʹΑΔએݴతͳઃఆ 35
Slide 36
Slide 36 text
;0;05FDIOPMPHJFT *OD ˔ίϯςφͷઃఆ ˓ϕʔεΠϝʔδɺόʔδϣϯɺϙʔτ ˔ཁٻ͢Δ$16ϝϞϦͳͲͷϦιʔε ˔ϔϧενΣοΫ ˔ڥม ˔ࣗಈεέʔϧͷεέʔϧΠϯΞτͷ݅ :".-ʹΑΔએݴతͳઃఆ 36
Slide 37
Slide 37 text
;0;05FDIOPMPHJFT *OD 37
Slide 38
Slide 38 text
;0;05FDIOPMPHJFT *OD :".-ߏཧʹΑΔքͷม Խ 38 VM SSH Git push VM
Slide 39
Slide 39 text
;0;05FDIOPMPHJFT *OD 39 VM SSH Git push VM :".-ߏཧʹΑΔքͷม Խ
Slide 40
Slide 40 text
;0;05FDIOPMPHJFT *OD ։ൃεΩʔϚͷมԽͱ %FW0QT 40 ˔։ൃͱΠϯϑϥͷ֞ࠜͷϥΠϯ͕มΘΔ ˓ΞϓϦଆͰߏͷมߋΛՃ͑ΒΕΔൣғ͕૿͑Δ ˔%FW0QTͷઢҾΛܾΊΔͷϓϩμΫταʔϏεʹ ؔΘΔΤϯδχΞࣗ
Slide 41
Slide 41 text
;0;05FDIOPMPHJFT *OD ˔,VCFSOFUFTɺ%PDLFSΛ$3* ίϯςφΛ࣮ߦͤ͞Δ ͨΊͷϥϯλΠϜ࣮ ͷͭͱͯ͠ೝ͍ࣝͯ͠Δ ˓,VCFSOFUFT্ͰίϯςφΛʮಈ͔͚ͩ͢ʯͰ͋Εɺ ଞͷ$3*Λ͏͜ͱͰ͖Δ ˙DPOUBJOFSE ˙DSJPͳͲ ,VCFSOFUFTͱ%PDLFS 41
Slide 42
Slide 42 text
;0;05FDIOPMPHJFT *OD ˔$3*͕ੜ·ΕΔલɺ,VCFSOFUFT%PDLFSʹશʹґଘ ˓%PDLFSͳ͠Ͱ,VCFSOFUFT͕ಈ͔ͳ͔ͬͨͨΊɺ %PDLFSࣗମ͕ڧ͍ྗΛ͍࣋ͬͯͨ ˔ݱࡏ$3*ͷ༷ࡦఆʹΑͬͯଞͷϥϯλΠϜ͕ಈ͘ ˓%PDLFSࣗମ,VCFSOFUFTͷ࿈ܞΛڧԽ͢Δಈ͖ ˠ%PDLFS͕,VCFSOFUFTʹै͢ΔΑ͏ͳߏਤʹͳͬͨ ,VCFSOFUFTͱ%PDLFS 42
Slide 43
Slide 43 text
;0;05FDIOPMPHJFT *OD ˔$3*ʹίϯςφͷ࣮ߦʹඞཁͳػೳ͔͠ͳ͍ ˓%PDLFSʹؚ·ΕΔػೳʹɺ,VCFSOFUFT্Ͱ ͍ͬͯΔػೳɺ͍ͬͯͳ͍ػೳ͕͋Δ ,VCFSOFUFTͱ%PDLFS 43
Slide 44
Slide 44 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSͷ͓͞Β͍ ˔%PDLFSίϯςφͱ%PDLFSΠϝʔδ ˔%PDLFSͰղܾͰ͖Δ͜ͱɾղܾͰ͖ͳ͍͜ͱ ˔ίϯςφΦʔέετϨʔγϣϯͷجૅ ˔,VCFSOFUFTͱ%PDLFSͷ͔͔ΘΓ ˔,VCFSOFUFTҎ֎ͷίϯςφΦʔέετϨʔγϣϯ ΞδΣϯμ 44
Slide 45
Slide 45 text
;0;05FDIOPMPHJFT *OD ˔%PDLFS4XBSN ˔.BSBUIPO.FTPT ˔)BTIJDPSQ/PNBE ˔"NB[PO&$4 ༷ʑͳίϯςφΦʔέετϨʔγϣϯ 45
Slide 46
Slide 46 text
;0;05FDIOPMPHJFT *OD ˔%PDLFSίϯςφΞϓϦέʔγϣϯ։ൃʹ͓͍ͯ ैདྷ՝ͱͳ͍͍͔ͬͯͨͭ͘ͷΛղফͯ͘͠ΕΔ ˔%PDLFS୯ମͰຊ൪ӡ༻ʹඞཁͳཧ༻ͷػೳ͕ෆ ͍ͯ͠ΔͨΊɺίϯςφΦʔέετϨʔγϣϯ͕ඞཁ ˔,VCFSOFUFT͋͘·Ͱબࢶͷͭ ˓%PDLFSͱ࡞Γʹࠩҟ͕͋Γɺنײ͕େ͖͍ ͨΊɺΫϥυΛ࠶࣮͢Δ͘Β͍ͷ֮ޛͰΉ͖ ·ͱΊ 46
Slide 47
Slide 47 text
;0;05FDIOPMPHJFT *OD ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 47
Slide 48
Slide 48 text
No content