Dockerアプリケーションのポータビリティを考える #dockerjp

B4afc7d853d7f1cb6a253d3c7183c05a?s=47 Naoya Ito
April 11, 2014

Dockerアプリケーションのポータビリティを考える #dockerjp

B4afc7d853d7f1cb6a253d3c7183c05a?s=128

Naoya Ito

April 11, 2014
Tweet

Transcript

  1. %PDLFSΞϓϦέʔγϣϯͷ ϙʔλϏϦςΟΛߟ͑Δ /BPZB*UP ,"*;&/QMBUGPSN*OD 4FOJPS5FDIOPMPHZ"EWJTPS  %PDLFS.FFUVQ5PLZP

  2. %PDLFS͸ΞϓϦέʔγϣϯ Λϙʔλϒϧʹ͢Δɻ

  3. ̎ͭͷจ຺  %PDLFSίϯςφ͕Լ૚Λந৅Խ͢Δ  %JTQPTBCMFͳ੍໿ʹΑΓΞϓϦέʔ γϣϯʹ࠶ݱՄೳੑ͕ཁٻ͞ΕΔ

  4. #VJME0ODF 3VO "OZXIFSF

  5. %PDLFSίϯςφ͕Լ૚Λந৅Խ •  #VJME0ODF 3VO"OZXIFSF h"p://www.slideshare.net/dotCloud/docker-­‐intro-­‐november

  6. ྫBUMBTTJBOKJSB

  7. $  docker  run  atlassian/jira   ͜Ε͚ͩͰɺΠϝʔδ͕ ެ։ϨϙδτϦ͔Β QVMM͞ΕͯίϯςφͰ +*3"͕ىಈ͢Δ

  8. #VJME0ODF 3VO"OZXIFSF •  BUMBTTJBOKJSB͸%PDLFS͑͞ಈ͍ͯΕ ͹ɺͲ͜Ͱ΋ಈ͘ – -JOVY#PYɺCPPUEPDLFSɺ%JHJUBM 0DFBOɺ(PPHMF$PNQVUF&OHJOF •  ϩʔΧϧͰಈ͍ͯͨ΋ͷΛɺΫϥ΢υ΁ 8FCΞϓϦέʔγϣϯ

    ͷ഑෍Λ%PDLFSϨϙ δτϦͰߦ͏ͷ͕ී௨ʹ ͳΔ೔͕དྷΔ 
  9. 5IF'BDUPS"QQ

  10. ΋͏ҰͭͷϙʔλϏϦςΟ •  %PDLFSͱ͍͏ΑΓ*NNVUBCMF *OGSBTUSVDUVSF༝དྷͷ࿩ •  ࠶ݱՄೳͳΞϓϦέʔγϣϯ

  11. *NNVUBCMF*OGSBTUSVDUVSF •  %JTQPTBCMF$PNQPOFOUT •  ෆมͳɺঢ়ଶΛ࣋ͨͳ͍ɺഇغՄೳͳ

  12. ΞϓϦͷσϓϩΠઌΛ ίϯςφʹ͢Δ͜ͱΛߟ͑Δ •  )FSPLV΍5SBWJT$*తͳ •  ίϯςφͳͷͰɺΞϓϦέʔγϣϯ͕ຖ ౓ഇغ͞Εͯ͠·͏ •  Ώ͑ʹɺΞϓϦέʔγϣϯʹ͸࠶ݱੑ͕ ٻΊΒΕΔ

    ݁ՌతʹɺΞϓϦ͕ϙʔ λϒϧʹͳΔ
  13. )FSPLV )FSPLV͸HJUQVTI͢Δຖɺ৽͍͠؀ڥ ίϯςφ Λ࡞Γɺݹ͍؀ڥΛغͯΔ

  14. ΞϓϦΛ࠶ݱՄೳʹ͢Δʹ͸ •  εςʔτϨε׌ͭ4IBSFE/PUIJOH •  ࣮ߦ֎෦؀ڥΛ໌֬Խɾந৅Խɾႈ౳Խ – #VOEMFS – 3BDL – 'PSFNBO ίϯςφ͕ཁٻ͢ΔΠϯλ ϑΣʔεʹΑͬͯɺΞϓϦ

    έʔγϣϯʹྑ੍͍໿Λ՝ ͢͜ͱ͕Ͱ͖Δ
  15. 5IF5XFMFWF'BDUPS"QQ h"p://twelve-­‐factor-­‐ja.herokuapp.com/   (オリジナル:  h"p://12factor.net/)

  16. %PDLFSͰͲ͏͢΂͖͔ •  'BDUPS"QQతͳͷ͕ྑ͍Πϯλ ϑΣʔεͳͷ͸Θ͔ͬͨ •  ͡Ό͋ɺͦΜͳίϯςφΛ%PDLFSͰͲ ͏༻ҙ͢΂͖͔ – ࡞ͬͯΈͨ

  17. OBPZBEPDLFSQBBTFYBNQMF •  HJUIVCDPNOBPZBEPDLFSQBBT FYBNQMF •  HJUQVTIΛܖػʹ%PDLFSίϯςφΛ ࡞ΓΞϓϦέʔγϣϯΛ഑උ͠ಈ͔͢ – CPPUEPDLFSɺHJUIPPLT QVMMSFRVFTUຖʹΞϓϦ έʔγϣϯΛ্ཱͪ͛ͯ

    63-ΛׂΓ౰ͯΔɺΈ͍ͨ ͳ͜ͱΛࢹ໺ʹೖΕͯΔ
  18. 4JOBUSBΞϓϦέʔγϣϯ ΛHJUQVTI͢Δͱ %PDLFSίϯςφ͕ىಈ͠ɺ ͦͷ্Ͱಈ͘

  19. ࣌ؒ͋ͬͨΒσϞ

  20. ΍ͬͯΈͨ͜ͱ •  લఏ3VCZ 4JOBUSBͳ8FCΞϓϦ •  ࣮ߦ؀ڥ SVCZ΄͔ ͷϏϧυ   ඞཁόʔδϣϯͷSVCZ΍CVOEMFSͳͲΛ

    ༧ΊೖΕͨ%PDLFSΠϝʔδΛ࡞͓ͬͯ͘ ํࣜ   )FSPLVͷCVJMEQBDLͰΦϯσϚϯυʹ Ϗϧυ͢Δํࣜ •  %PLLVΈ͍ͨͳ σϞͬͨͷ͸ͷ΄͏
  21. #VJMEQBDL •  ΞϓϦέʔγϣϯͷ࣮ߦ؀ڥΛϏϧυ͢ ΔͨΊͷεΫϦϓτύοέʔδ – ΠϯλϑΣʔε͕ඪ४Խ͞ΕͯΔ •  CJOEFUFDUŋŋŋର৅ΞϓϦͷݴޠͳͲΛ൑ఆ •  CJODPNQJMFŋŋŋ࣮ߦʹඞཁͳ؀ڥΛϏϧυ – 

    ྫSVCZͷϏϧυɺCVOEMFJOTUBMMFUD •  CJOSFMFBTFŋŋŋΞϓϦέʔγϣϯ࣮ߦίϚϯυ ͷܾఆ –  IFSPLVIFSPLVCVJMEQBDLSVCZ IFSPLVIFSPLV CVJMEQBDLOPEFKT NJZBHBXBIFSPLVCVJMEQBDL QFSMͦΕͧΕʹͭͷεΫϦϓτ͕ೖͬͯΔ
  22. 1.  アプリ を   git  push 2.  post-­‐update  hoook  で

      docker  run   3.  コンテナ起動 4.    アプリを  git  clone (※cloneじゃなくpushにしたい)
  23. ΞϓϦͷHJUDMPOFޙ •  EPDLFSSVOͰΞϓϦέʔγϣϯίʔυ ʹରͯ͠CVJMEQBDLΛద༻ – CJOEFUFDUͰ൑ఆ͠USVF͕ฦͬͨΒɺͦ ͷCVJMEQBDLͷCJODPNQJMFͰϏϧυ – CJOSFMFBTFͰܾఆ͞Ε࣮ͨߦίϚϯυΛ FYFD  

  24. SVCZͷϏϧυͳͲΦϯ σϚϯυͰ

  25. ΍ͬͯΈͯࢥͬͨ͜ͱ

  26. CVJMEQBDLΛ࢖͏ͱŋŋŋ •  ॊೈɻΞϓϦέʔγϣϯͷ࣮ߦ؀ڥΛޙ ͔ΒಈతʹܾఆͰ͖Δ – ΑͬͯɺݴޠͷछྨYόʔδϣϯ͝ͱʹ؀ڥ Λ࡞͓ͬͯ͘ŋŋŋͱ͔ඞཁͳ͍

  27. Ͱ΋ɺͪΐͬͱ଴ͯΑ  •  %PDLFS͸Πϝʔδ࡞ͬͯίϯςφىಈ͢ Δͷ௒؆୯͡ΌΜ  – CVJMEQBDLํࣜ͸ॊೈ͚ͩͲɺͦͷॊೈੑ ཁΔ  – SVCZ༻ΠϝʔδɺOPEFKT༻Λ࡞͓͍ͬͯͯɺ

    ಈ͔͢΋ͷʹ߹ΘͤͯΠϝʔδΛબ୒ͯ͠ SVO͢Δํ͕ࣜ୯७׌ָͭͩͬͨ
  28. Ωϡʔ˓ʔ෼ΫοΩϯάํࣜ •  ʮ͜͜ͰSVCZ CVOEMFS͕ඞཁ ʹͳΓ·͕͢ŋŋŋ͋Β͔͡Ί࡞͓͖ͬͯ· ͨ͠ʯ %PDLFSͳΒ࡞Γஔ͖؆୯ɻ %PDLFSϨϙδτϦͰڞ༗ ΋0,

  29. ΞΠσΞ ·ͩ΋΍΋΍  •  CVJMEQBDLతͳ%PDLFSJNBHFT – CVJMEQBDLͷEFUFDUͰ؀ڥΛ൑ఆ͠ – ͦͷ؀ڥʹదͨ͠อଘࡁΈίϯςφΛબ୒͠ – CVJMEQBDLͷSFMFBTFͷΑ͏ʹͦͷίϯς φʹܾΊΒΕͨૢ࡞Λ࣮ߦͤ͞Δ CVJMEQBDLͰϏϧυͨ͠

    ίϯςφΛDPNNJUͯ͠ ࠶ར༻ɺͱ͔Ͱ΋͍͍͔ 
  30. ͯͳΘ͚Ͱɺ·ͱΊ •  %PDLFS͸ΞϓϦέʔγϣϯͷϙʔλϏϦ ςΟΛߴΊΔ – ͭ͸#VJME0ODF 3VO"OZXIFSFͷ࿩ – ΋͏ͭ͸5IF'BDUPS"QQͳ࿩ •  ޙऀͰ͸ɺίϯςφΛͲ͏༻ҙ͢΂͖͔ – Ωϡʔ˓ʔ෼ΫοΩϯάํࣜͰׂͱΑ͍

  31. એ఻ •  ,"*;&/1MBUGPSN*OD͸ΤϯδχΞื ूͯ͠·͢ •  ΠϯϑϥࣗಈԽɺ*NNVUBCMFɺ%PDLFS ͱ͔΍͍͖͍ͬͯͨํɺ͓଴ͪͯ͠·͢