Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dockerでドカドカ on FuraIT #36

7437b9552e193bb1f8ea757bf1a51175?s=47 Aruneko
October 07, 2017

Dockerでドカドカ on FuraIT #36

FuraIT #36で発表したDocker勉強会の資料です。
ハンズオンで使用したファイルはこちら
https://github.com/aruneko/furait36_docker

7437b9552e193bb1f8ea757bf1a51175?s=128

Aruneko

October 07, 2017
Tweet

More Decks by Aruneko

Other Decks in Technology

Transcript

  1. %PDLFSͰυΧυΧ 'VSB*5 XSJUUFOCZ"SVOFLP

  2. ͱΓ͋͑ͣΠϯετʔϧ w ֤छσΟετϦʹEPDLFSύοέʔδͱͯ͠ొ࿥ࡁΈ ͷ͸ͣ  w ޙͰ࢖͏ͷͰEPDLFSDPNQPTFύοέʔδ΋ಋೖ w 6CVOUVͱ"SDIͱNBD04Ͱͷྫ •

    $ sudo apt install docker docker-compose • $ sudo pacman -S docker docker-compose • $ brew cask install docker
  3. ϋϯζΦϯ༻ϑΝΠϧ w (JUIVCʹ্͛ͯ͋ΔͷͰΫϩʔϯPS;JQͰམͱ͍ͯͩ͘͠͞ w IUUQTHJUIVCDPNBSVOFLPGVSBJU@EPDLFS w ޙ΄Ͳ࣮ࢪ͢Δԋशͷ౴͑͸BOTXFSϒϥϯνʹ͋Γ·͢

  4. ࣗݾ঺հ w ͋ΔͶ͜ w -0$"-ֶੜ෦લ෦௕ w ࣨའ޻ۀେֶ৘ใઐ߈. w ֶ಺Ͱ4".*5΍ͬͯ·͢ w

    "SDI/FP7JN74$PEF)BTLFMM w ϥϘΫϥ΢υαʔϏε 3FENJOFͳͲ ʹ%PDLFSΛ׆༻த
  5. ࠓ೔ͷ໨ඪ w ٕज़త֓ཁ͕Θ͔Δ w %PDLFSpMFΛॻ͚ΔΑ͏ʹͳΔ w ίϯςφΛ࡞ΕΔΑ͏ʹͳΔ w .VMUJ4UBHF#VJME͕Ͱ͖ΔΑ͏ʹͳΔ w

    ෆشൃੑσʔλΛѻ͑ΔΑ͏ʹͳΔ w DPNQPTF͕࢖͑ΔΑ͏ʹͳΔ
  6. %PDLFSͬͯʁ

  7. ߦͰද͢ͱ w ΞϓϦέʔγϣϯΛ w ίϯςφʹด͡ࠐΊͯ w ۚଠ࿠᷒తʹྔ࢈Ͱ͖ͯ w ࢖͍ࣺͯΒΕΔ w

    ͳΜ͔ศརͳϠπ
  8. %PDLFSͷ׆༻ྫ

  9. ։ൃ؀ڥͱͯ͠ w ίϯςφͷίϐʔ͕༰қͳͨΊෳ਺ਓͰͷ։ൃ؀ڥڞ༗ʹศར w ؀ڥͷҧ͍͕ຒ·ΓɺͦΕʹؔ࿈͢Δෆ۩߹΋ൃੜ͠ͳ͘ͳΔ w ίϯςφΛೖΕସ͑Δ͚ͩͰ؀ڥ͕όʔδϣϯΞοϓՄೳ

  10. ຊ൪؀ڥͱͯ͠ w ٸͳΞΫηε૿ՃʹΑΔαʔόʔͷ૿ઃ΋؆୯ w όʔδϣϯΞοϓ΋ίϯςφΛೖΕସ͑Δ͚ͩʂ w Πϯϑϥ؅ཧ͕ςΩετϑΝΠϧͰՄೳ w (JUͰόʔδϣϯ؅ཧͰ͖ͪΌ͏

  11. %PDLFSͷ͘͠Έ

  12. %PDLFSͷ֓ཁ %PDLFS ίϯςφٕज़ ΤίγεςϜ

  13. Ծ૝Խͷҧ͍ )BSEXBSF )PTU04 7JSUVBM.BDIJOF)PTU (VTU04 1SPDFTT )BSEXBSF )PTU04 -JOVY,FSOFM %PDLFS%BFNPO

    1SPDFTTPO$POUBJOFS ϗετܕԾ૝Խ ίϯςφܕԾ૝Խ
  14. %PDLFSίϯςφ w ٕज़ͱͯ͠͸ผʹ৽͘͠ͳ͍ DISPPU KBJM TZTUFNEOTQBXOʜFUD  w ಛ௃ͱݴͬͯ΋͜Μͳײ͡ w

    ϓϩηε͕ϗετଆͱ͸ಠཱ w ωοτϫʔΫ΋ಠཱ w DISPPUͱಉ༷ίϯςφ಺ͷΈͷSPPUσΟϨΫτϦ w Ϣʔβʔ΋ಠཱ
  15. ίϯςφͷਖ਼ମ %PDLFS$POUBJOFS *NBHF-BZFS$ *NBHF-BZFS# *NBHF-BZFS" 8SJUBCMF-BZFS %PDLFS*NBHF 3FBE0OMZ #BTF*NBHF 04

    .JEEMFXBSF "QQMJDBUJPO
  16. ίϯςφͷਖ਼ମ %PDLFS$POUBJOFS *NBHF-BZFS$ *NBHF-BZFS# *NBHF-BZFS" 8SJUBCMF-BZFS %PDLFS*NBHF 3FBE0OMZ )5.-ϑΝΠϧ /HJOY

    6CVOUV ಈ࡞࣌ͷΩϟογϡ౳
  17. %PDLFSΤίγεςϜ %PDLFS)VC -PDBM %PDLFS*NBHF" %PDLFS*NBHF# %PDLFS*NBHF$ %PDLFS*NBHF% %PDLFS*NBHF" /FX%PDLFS*NBHF औΓࠐΈ

    ొ࿥
  18. %PDLFS)VC w IUUQTIVCEPDLFSDPN w %PDLFS*NBHFͷެࣜΞοϓϩʔυઌ w ࡞Γ͍ͨαʔϏεʹԠͨ͡ΠϝʔδΛݕࡧͯ͠ৄࡉΛ֬ೝ

  19. ΤίγεςϜͱΠϝʔδ w ๛෋ͳ#BTF*NBHF w 6CVOUV $FOU04 "SDI-JOVY %FCJBO "MQJOF-JOVYʜFUD w

    ෳ਺ͷ*NBHFؒͰ-BZFSΛڞ༗͢Δ͜ͱ͕Մೳ w μ΢ϯϩʔυ༰ྔͷઅ໿ w ࣗ࡞ίϯςφొ࿥࣌ͷΞοϓϩʔυ༰ྔͷઅ໿
  20. ίϯςφΛ࡞ͬͯΈΔ

  21. ॳظઃఆ w -JOVYͷਓ͸ҎԼͷखॱͰॳظઃఆ͍ͯͩ͘͠͞ w NBD04ͷਓ͸ෆཁͰ͢ w ࣗ෼ͷϢʔβʔΛ%PDLFSάϧʔϓʹॴଐ͓ͤͯ͘͞ w ͨͩ͠ࣄ্࣮ͷSPPUʹͳΔͷͰऔѻ஫ҙ •

    $ sudo gpasswd -a USER_NAME docker w ऴΘͬͨΒ࠶ϩάΠϯͯ͠ɺ%PDLFSΛىಈ • $ sudo systemctl enable --now docker
  22. TMίϯςφΛ࡞Ζ͏ʂ w ҰൃωλίϚϯυͰ༗໊ͳTMίϚϯυ͕ಈ͘ίϯςφΛ࡞Ζ͏ w ୯ͳΔΞϓϦέʔγϣϯͰɺอଘ͢Δ΋ͷ͕ͳ͍ͷͰ؆୯

  23. ίϯςφ࡞੒ͷྲྀΕ w ίϯςφʹඞཁͳίϚϯυ΍ϑΝΠϧͷ੔ཧ w ੔ཧͨ͠ίϚϯυ܈͔Β%PDLFSpMFͷॻ͖ى͜͠ w %PDLFSpMF͔ΒΠϝʔδΛੜ੒ w Πϝʔδ͔ΒίϯςφΛىಈ

  24. %PDLFSpMFΛॻ͜͏ w %PDLFSpMF͸ɺ؀ڥߏஙͷखॱॻ w ϕʔεΠϝʔδͱͷࠩ෼͚ͩΛॻ͚͹ྑ͍ w ϑΝΠϧ໊΋֦ுࢠͳ͠ͷͣ͹Γz%PDLFSpMFz w Ͱ΋׬શʹखॱΛ೺Ѳ͍ͯ͠ͳ͍ͱ͍͖ͳΓ͸ॻ͚ͳ͍ w

    ˠͱΓ͋͑ͣखॱΛ֬ೝ͢Δ
  25. ςετ༻ίϯςφΛ࡞Δ w %PDLFSpMFʹ·ͱΊΔલͷςετ༻ίϯςφͰݕূ w ৭ʑ؆୯ͳͷͰήετ04͸6CVOUVͰ΍ͬͯΈ·͢

  26. %PDLFS*NBHFͷμ΢ϯϩʔυ • $ docker pull ubuntu:16.04 w ίϩϯΑΓޙΖͰΠϝʔδͷλάΛࢦఆͰ͖Δ w ֤ΠϝʔδͷλάͷҰཡ͸%PDLFS)VCͰ֬ೝ

  27. ςετ༻ίϯςφͷىಈ • $ docker run -it --rm --name test ubuntu:16.04

    Φϓγϣϯ આ໌ JU UUZΛ࡞ͬͯඪ४ೖྗΛͭͳ͙ SN ίϯςφऴྃ࣌ʹίϯςφΛ࡟আ OBNF ίϯςφʹ໋໊
  28. 4-ͷΠϯετʔϧ w ίϯςφ಺ͰBQUΛ࢖ͬͯTMΛೖΕͯΈΔ w ύοέʔδ໊͕Θ͔Βͳ͍ͱ͖͸BQUͰ୳ͦ͏ w ೖΕऴΘͬͨΒɺIJTUPSZίϚϯυͰ࣮ߦͨ͠ίϚϯυΛ֬ೝ w %PDLFSpMF͸શࣗಈ࣮ߦ w

    ࣮ߦதͷϓϩϯϓτʹೖྗͰ͖ͳ͍ w ڧ੍ΠϯετʔϧΦϓγϣϯͳͲ BQUͷ৔߹Z ͕ඞਢͳͷͰ஫ҙ w ϨΠϠ͕෼ׂ͞ΕΔͱෆ౎߹͕͋ΔͷͰʮʯͰશίϚϯυΛͭͳ͙
  29. %PDLFSpMFͷߏ੒ w %PDLFSpMFͰ࢖ΘΕΔ໋ྩ͸͢΂ͯେจࣈ w ໋ྩͷޙʹҾ਺Λεϖʔε۠੾ΓͰॻ͍͍ͯ͘ w ͪΐͬͱมΘͬͨγΣϧεΫϦϓτతͳ w ͓޷ΈͷΤσΟλͰʮ%PDLFSpMFʯΛ৽ن࡞੒͠Α͏

  30. Α͘࢖͏%PDLFSpMF໋ྩ ໋ྩ આ໌ '30. #BTF*NBHFͷࢦఆ 36/ -JOVYίϚϯυͷ࣮ߦ 803,%*3 DEͱಉ͡ʢଘࡏ͠ͳ͍σΟϨΫτϦ͸ࣗಈͰੜ੒ʣ $01:43$%45

    43$͔Β%45ʹϑΝΠϧΛίϐʔ
  31. %PDLFSpMFͷྫ FROM ubuntu:16.04 RUN apt update && \ apt install

    -y sl && \ ln -s /usr/games/sl /usr/bin/sl
  32. %PDLFSpMF͔ΒΠϝʔδΛ࡞੒ w %PDLFSpMF͕Ͱ͖ͨΒɺ͜ΕΛ࢖ͬͯࣗ࡞ΠϝʔδΛ࡞੒ • $ docker image build -t sl

    . w UɿΠϝʔδ໊Λ෇͚Δ w ࠷ޙͷʮʯɿ%PDLFSpMFͷ͋ΔσΟϨΫτϦ΁ͷ૬ରύε
  33. ࣗ࡞Πϝʔδ͔ΒίϯςφΛੜ੒ • $ docker container run -it -d --name sl_test

    sl w Ұ൪࠷ޙͷҾ਺ʹͰ͖͕͋ͬͨࣗ࡞ΠϝʔδΛࢦఆ w EɿόοΫάϥ΢ϯυ࣮ߦ w ίϯςφऴྃ࣌ʹফ͑ͨΒࠔΔͷͰSN͸ࢦఆ͠ͳ͍
  34. ίϯςφ΁ͷ઀ଓ w ίϯςφ಺Ͱ৽͘͠CBTIϓϩηεΛ࡞Γɺͦͷඪ४ೖྗΛܨ͙ • $ docker container exec -it sl_test

    /bin/bash w ͜ΕͰTMίϚϯυ͕͖ͨͨ์୊ʂ w FYJUͯ͠ൈ͚·͠ΐ͏
  35. ίϯςφ಺ίϚϯυͷ௚઀࣮ߦ w CBTI͕ͦͷ··ಈ͘Α͏ʹɺଞͷϓϩάϥϜ΋ಈ͘ w TMΛͦͷ··࣮ߦͯ͠ΈΑ͏ • $ docker container exec

    -it sl_test sl w େ͚͛ͩ͞Ͳ ݩͷ؀ڥΛԚછͤͣʹ৭ʑೖΕͯ࢖͑Δศར͞
  36. ίϯςφͷ࡟আ w ͍Βͳ͘ͳͬͨίϯςφ͸ࢭΊ͔ͯΒ࡟আ w ಈ͍͍ͯΔίϯςφ͸DPOUBJOFSαϒίϚϯυͷMTίϚϯυͰ֬ೝ w ఀࢭத΋ؚΊ͢΂ͯͷίϯςφΛݟ͍ͨͳΒBΦϓγϣϯ • $ docker

    container ls -a • $ docker ps -a w ίϯςφ*%·ͨ͸ίϯςφ໊Λࢦఆͯ͠࡟আ • $ docker container stop CONTAINER_NAME • $ docker container rm CONTAINER_NAME
  37. Πϝʔδͷ࡟আ w ͍Βͳ͍Πϝʔδ͸༰ྔΛ৯͏͚ͩͳͷͰ࡟আ w Πϝʔδ͸JNBHFαϒίϚϯυͰૢ࡞ w ΠϝʔδͷҰཡ͸MTίϚϯυͰऔಘ • $ docker

    image ls • $ docker images w SNίϚϯυͰ࡟আ • $ docker image rm IMAGE_NAME • $ docker rmi IMAGE_NAME
  38. ԋशɿ3VCZίϯςφͷ࡞੒ w 3VCZΠϯλϓϦλ͕ಈ͘ίϯςφΛ࡞ͬͯΈΑ͏ w ެࣜͷSVCZΠϝʔδ΋ଘࡏ͠·͕͢ʜ  w %PDLFSpMF*NBHF࡞੒ίϯςφੜ੒ίϚϯυ࣮ߦ w 3VCZΠϯλϓϦλͷىಈ͸ʮJSCʯίϚϯυͰ͢

  39. ԋशɿ8FCίϯςφͷ࡞੒ w /HJOYͰ)5.-Λදࣔ͢ΔίϯςφΛ࡞ͬͯΈΑ͏ w OHJOYϕʔεΠϝʔδΛ࢖͏ͱศརͰ͢ w VTSTIBSFOHJOYIUNMҎԼʹϑΝΠϧΛίϐʔ͠·͢ w ϑΝΠϧͷίϐʔʹ͸$01:໋ྩΛ࢖͍·͢ w

    ىಈ͸ҎԼͷίϚϯυͰɻϙʔτΛ࿐ग़ͤ͞ΔઃఆΛ௥Ճͯ͠·͢ • $ docker run -d --name nginx_test -p 80:80 <image_name>
  40. લ൒͸͜͜·Ͱʂ

  41. .VMUJ4UBHF#VJME

  42. Ϗϧυ͕ඞཁͳίϯςφΛ࡞Δ w ͍··Ͱͷ%PDLFSίϯςφͷ࡞Γํ w 36/໋ྩΛ෼ׂ͢ΔͱϨΠϠ͕૿͑Δ w Ϗϧυʹඞཁͳ΋ͷΛΠϯετʔϧͯ͠ w ιʔείʔυΛམͱ͖ͯͯ͠ w

    Ϗϧυͯ͠ w Ϗϧυ࣌ͷґଘύοέʔδɾιʔείʔυΛফ͢ w ͜ΕΒΛ෼ׂ࣮ͯ͠ߦ͢Δͱ
  43. ࢒೦ͳΠϝʔδ %PDLFS*NBHF Ϗϧυ ιʔεμ΢ϯϩʔυ ґଘΠϯετʔϧ ෆཁ෺ͷফڈ ͍Βͳ͍΋ͷ·Ͱ
 Πϝʔδʹؚ·ΕΔ

  44. શମΛϨΠϠʹ·ͱΊΔ %PDLFS*NBHF ෆཁ෺ͷফڈ Ϗϧυ ιʔεμ΢ϯϩʔυ ґଘΠϯετʔϧ ͍Βͳ͍΋ͷ͸
 ؚ·Εͳ͍ ˠ഑෍αΠζͷॖখ

  45. Ͱ΋΍ͬͺΓ w ໘౗ w ͦ͜Ͱɺ.VMUJ4UBHF#VJME

  46. .VMUJ4UBHF#VJME #VJME*NBHF Ϗϧυ ιʔεμ΢ϯϩʔυ ґଘΠϯετʔϧ 3VOUJNF*NBHF ґଘΠϯετʔϧ Ϗϧυ੒Ռ෺ ੒Ռ෺͚ͩίϐʔ͠ɺ
 ࣮ߦ༻ίϯςφͷΈΛ഑෍

  47. 4-Ͱ.VMUJ4UBHF#VJMEΛମݧ w 4-ΛϏϧυͯ͠ɺͦͷ੒Ռ෺͚ͩΛ࣮ߦ࣌ίϯςφʹࡌͤΔ w ࣮͸4-ͷ࣮ߦʹ͸ODVSTFT͕ඞཁ w ࣮ߦ࣌ίϯςφʹΠϯετʔϧ͓ͯ͘͠ w %PDLFSͰΑ͘࢖͏ܰྔ-JOVYͷ"MQJOF-JOVYΛ࢖ͬͯ΍ͬͯΈΑ͏

  48. 4-Ͱ.VMUJ4UBHF#VJMEΛମݧ FROM alpine AS build-sl RUN apk --no-cache add alpine-sdk

    ncurses-dev && \ git clone https://github.com/mtoyoda/sl.git && \ cd sl && \ make FROM alpine RUN apk --no-cache add ncurses COPY --from=build-sl /sl/sl /usr/bin/sl "4ͰதؒΠϝʔδʹ໋໊ GSPNͰதؒΠϝʔδ͔Β੒Ռ෺Λίϐʔ
  49. Մมσʔλͱ
 ෳ਺ίϯςφͷ࿈ܞ

  50. Մมσʔλͷߦํ w %PDLFSίϯςφ͸࢖͍ࣺͯ w ՄมσʔλϨΠϠ΋ίϯςφʹؚ·ΕΔ w ΑͬͯՄมσʔλ͸ίϯςφ͕ࢮ͵ͱҰॹʹࢮ͵ w ඇৗʹࠔΔʢ࣮ࡍࠔͬͨʣ

  51. %PDLFS7PMVNF w Մมσʔλ͸7PMVNFͱͯ͠ผͷͱ͜Ζʹஔ͖ɺͦΕΛϚ΢ϯτ w छྨͷํ๏ w طଘσΟϨΫτϦͷϚ΢ϯτ w WPMVNFίϚϯυʹΑΔੜ੒

  52. طଘσΟϨΫτϦͷϚ΢ϯτ w ϗετʹσʔλอଘ༻σΟϨΫτϦΛ࡞ΓͦΕΛϚ΢ϯτ͢Δ w ύʔϛογϣϯؔ܎͕΍΍͍͜͠ͷͰɺ͋Μ·Γ͓͢͢Ί͠ͳ͍ w ίϯςφଆͰੜ੒͞ΕͨσʔλͷṖύʔϛογϣϯ w ॻ͖ࠐΉଆΛϗετ͔ήετʹݶఆ͢Ε͹0,

  53. WPMVNFίϚϯυʹΑΔੜ੒ w %PDLFSʹ͢΂͓ͯ·͔ͤ͢Δ w ྑ͍ײ͡ʹ΍ͬͯ͘ΕΔͷͰָ • $ docker volume create

    --name hogehoge
  54. 3FENJOFίϯςφΛ࡞Δ w ϓϩδΣΫτ؅ཧπʔϧ3FENJOFͷίϯςφΛ࡞ͬͯΈΔ w ͱΓ͋͑ͣԼௐ΂Λͯ͠ͲΜͳ෩ʹίϯςφΛ࡞Ε͹ྑ͍͔ݕ౼

  55. ΕͬͭԼௐ΂  w 3FENJOFίϯςφΛ࡞ΔͨΊʹԿ͕ඞཁ͔ΛԼௐ΂ w ͱΓ͋͑ͣ%PDLFS)VCͰݕࡧͯ͠ΈΔ w IUUQTIVCEPDLFSDPNSMJCSBSZSFENJOF

  56. ΕͬͭԼௐ΂  w ҎԼͷ߲໨ʹ஫໨ w 5BH w ґଘ͍ͯ͠Δίϯςφ w ࢖͑Δ؀ڥม਺

    w ಺෦Ͱ࢖͏ϙʔτ w ӬଓσʔλͷϚ΢ϯτ৔ॴ
  57. ΕͬͭԼௐ΂  w 5BH w MBUFTUͰΑͦ͞͏ w ґଘ͍ͯ͠Δίϯςφ w ͳΜΒ͔ͷ%#͕ඞཁΒ͍͠ͱΓ͋͑ͣ.Z42-

    w ࢖͑Δ؀ڥม਺ w %#ͷ઀ଓઌ΍ύεϫʔυ͕ࢦఆग़དྷΔΒ͍͠ w ಺෦Ͱ࢖͏ϙʔτ w ൪ w ӬଓσʔλͷϚ΢ϯτ৔ॴ w lVTSTSDSFENJOFpMFTzʹఴ෇ϑΝΠϧ͕ஔ͔ΕΔΒ͍͠
  58. ΕͬͭԼௐ΂  w .Z42-ʹ͍ͭͯ΋ಉ༷ͷ৘ใΛऩू͢Δ

  59. ΕͬͭԼௐ΂  w 5BH w MBUFTUͰΑͦ͞͏ w ࢖͑Δ؀ڥม਺ w SPPUͷύεϫʔυ΍ॳظ%#໊͕ࢦఆग़དྷΔΒ͍͠

    w ӬଓσʔλͷϚ΢ϯτ৔ॴ w lWBSMJCNZTRMzʹσʔλϕʔε͕ஔ͔ΕΔΒ͍͠
  60. Լௐ΂׬ྃ w ͬ͟ͱ͜ͷ͙Β͍Լௐ΂ग़དྷͨΒίϚϯυΛ૊ΈཱͯΑ͏ʂ

  61. 3FENJOFίϯςφΛ࡞Δ w ίϚϯυ͸ͨͬͨͷߦʢߦ͕୹͍ͱ͸ݴͬͯͳ͍ʣ • $ docker volume create --name redmine_db

    • $ docker volume create --name redmine_file • $ docker run -d --name rm-mysql \
 -e MYSQL_ROOT_PASSWORD=password \
 -e MYSQL_DATABASE=redmine -v redmine_db:/var/lib/mysql mysql • $ docker run -d -p 3000:3000 --name redmine \
 --link rm-mysql:mysql \
 -v redmine_file:/usr/src/redmine/files redmine
  62. 3FENJOFͷಈ࡞֬ೝ w IUUQMPDBMIPTU w QΦϓγϣϯͷࠨଆ͕ެ։ϙʔτͰӈଆ͕ίϯςφ಺෦ϙʔτ w ैͬͯ൪ϙʔτʹΞΫηε͢Ε͹0,

  63. ΊΜͲ͘͘͞ͳ͍ʁ w ͍͘ΒԿͰ΋ίϚϯυ͕௕͗͢Δ w αʔϏε͝ͱʹίϯςφΛݐͯΔίϚϯυΛԆʑͱೖྗͨ͘͠ͳ͍

  64. %PDLFS$PNQPTF w %PDLFSίϯςφͷ౷߹؅ཧπʔϧ w ZBNMܗࣜͷςΩετͰهड़ w ΍ͬͺΓ(JUͰ؅ཧ͠΍͍͢ w ϑΝΠϧ໊͸zEPDLFSDPNQPTFZNMzͰݻఆ w

    ͱΓ͋͑ͣ3FENJOFΛىಈͰ͖ΔϑΝΠϧΛݟͯΈΔ
  65. 3FENJOFͰͷྫ version: '3' services: mysql: image: mysql volumes: - data:/var/lib/mysql

    environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: redmine redmine: image: redmine volumes: - files:/usr/src/redmine/files ports: - "3000:3000" environment: REDMINE_DB_MYSQL: mysql REDMINE_DB_PASSWORD: password depends_on: - mysql volumes: data: files:
  66. ֤ηΫγϣϯͷઆ໌ ηΫγϣϯ໊ આ໌ WFSTJPO EPDLFSDPNQPTFZNMͷॻࣜόʔδϣϯ
 Λ࢖͍ͬͯΔͷͰ͋Ε͹Λهೖ TFSWJDFT ίϯςφͷఆٛ WPMVNFT ӬଓσʔλྖҬͷఆٛ

  67. TFSWJDFTηΫγϣϯ ηΫγϣϯ໊ આ໌ JNBHF 1VMMͯ͘͠ΔΠϝʔδ໊ WPMVNFT Ϛ΢ϯτ͢ΔϘϦϡʔϜ QPSUT ϙʔτͷϚοϐϯά FOWJSPONFOU

    ؀ڥม਺ EFQFOET@PO ґଘ͍ͯ͠Δίϯςφ໊ ಺෦%/4Ͱ໊લղܾΛ࣮ࢪ
  68. ࣮ߦͷ४උ w खಈͰ࡞ͬͨ3FENJOF.Z42-ίϯςφͷফڈ w 7PMVNF΋࡟আ͓ͯ͘͠ • $ docker volume ls

    • $ docker volume rm VOLUME_NAME
  69. ͍࣮͟ߦ • $ docker-compose up -d w EɿόοΫάϥ΢ϯυ࣮ߦ w ͢΂ͯͷίϯςφΛࢭΊ͍ͨͱ͖

    • $ docker-compose stop w ͢΂ͯͷίϯςφΛఀࢭ͔ͯ͠Β࡟আ͍ͨ͠ͱ͖ • $ docker-compose down
  70. ΊͬͪΌָ w ෳ਺ίϯςφΛ؅ཧ͢Δࡍʹ͸EPDLFSDPNQPTF w ໊લΛॻ͍͓͚ͯͩ͘ͰWPMVNF΋ࣗಈੜ੒

  71. 7PMVNFͷόοΫΞοϓ w όοΫΞοϓ༻ͷҰ࣌ίϯςφΛ࡞ΓϗετଆʹϑΝΠϧΛίϐʔ • $ mkdir bkup && cd bkup

    • $ docker run --rm -v VOL_NAME:/volume \
 -v $(realpath .):/bkp busybox \
 tar cvf /bkp/FILENAME.tar /volume
  72. ԋश w 8PSEQSFTTίϯςφΛEPDLFSDPNQPTFͰ࡞ͬͯΈΑ͏ w 8PSEQSFTTίϯςφͱ.Z42-ίϯςφͷ૊Έ߹Θͤ w 8PSEQSFTTଆ͔Β.Z42-ଆΛೝࣝ͢ΔͨΊͷ؀ڥม਺͸ʁ w ͲͷϙʔτΛόΠϯυ͢Δʁ

  73. ·ͱΊ w %PDLFSͷٕज़എܠ͕Θ͔ͬͨ w %PDLFSpMF͕࡞ΕΔΑ͏ʹͳͬͨ w ίϯςφ͕࡞ΕΔΑ͏ʹͳͬͨ w .VMUJ4UBHF#VJME͕Ͱ͖ΔΑ͏ʹͳͬͨ w

    7PMVNFΛѻ͑ΔΑ͏ʹͳͬͨ w $PNQPTFͰෳ਺ίϯςφ͕؅ཧͰ͖ΔΑ͏ʹͳͬͨ