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

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

Naoya Ito
April 11, 2014

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

Naoya Ito

April 11, 2014
Tweet

More Decks by Naoya Ito

Other Decks in Technology

Transcript

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

    %PDLFS.FFUVQ5PLZP

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  4. #VJME0ODF 3VO
    "OZXIFSF

    View full-size slide

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

    View full-size slide

  6. ྫBUMBTTJBOKJSB

    View full-size slide

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

    View full-size slide

  8. #VJME0ODF 3VO"OZXIFSF
    •  BUMBTTJBOKJSB͸%PDLFS͑͞ಈ͍ͯΕ
    ͹ɺͲ͜Ͱ΋ಈ͘
    – -JOVY#PYɺCPPUEPDLFSɺ%JHJUBM
    0DFBOɺ(PPHMF$PNQVUF&OHJOF
    •  ϩʔΧϧͰಈ͍ͯͨ΋ͷΛɺΫϥ΢υ΁
    8FCΞϓϦέʔγϣϯ
    ͷ഑෍Λ%PDLFSϨϙ
    δτϦͰߦ͏ͷ͕ී௨ʹ
    ͳΔ೔͕དྷΔ

    View full-size slide

  9. 5IF'BDUPS"QQ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  13. )FSPLV
    )FSPLV͸HJUQVTI͢Δຖɺ৽͍͠؀ڥ ίϯςφ
    Λ࡞Γɺݹ͍؀ڥΛغͯΔ

    View full-size slide

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

    View full-size slide

  15. 5IF5XFMFWF'BDUPS"QQ
    h"p://twelve-­‐factor-­‐ja.herokuapp.com/  
    (オリジナル:  h"p://12factor.net/)

    View full-size slide

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

    View full-size slide

  17. OBPZBEPDLFSQBBTFYBNQMF
    •  HJUIVCDPNOBPZBEPDLFSQBBT
    FYBNQMF
    •  HJUQVTIΛܖػʹ%PDLFSίϯςφΛ
    ࡞ΓΞϓϦέʔγϣϯΛ഑උ͠ಈ͔͢
    – CPPUEPDLFSɺHJUIPPLT
    QVMMSFRVFTUຖʹΞϓϦ
    έʔγϣϯΛ্ཱͪ͛ͯ
    63-ΛׂΓ౰ͯΔɺΈ͍ͨ
    ͳ͜ͱΛࢹ໺ʹೖΕͯΔ

    View full-size slide

  18. 4JOBUSBΞϓϦέʔγϣϯ
    ΛHJUQVTI͢Δͱ
    %PDLFSίϯςφ͕ىಈ͠ɺ
    ͦͷ্Ͱಈ͘

    View full-size slide

  19. ࣌ؒ͋ͬͨΒσϞ

    View full-size slide

  20. ΍ͬͯΈͨ͜ͱ
    •  લఏ3VCZ4JOBUSBͳ8FCΞϓϦ
    •  ࣮ߦ؀ڥ SVCZ΄͔
    ͷϏϧυ
      ඞཁόʔδϣϯͷSVCZ΍CVOEMFSͳͲΛ
    ༧ΊೖΕͨ%PDLFSΠϝʔδΛ࡞͓ͬͯ͘
    ํࣜ
      )FSPLVͷCVJMEQBDLͰΦϯσϚϯυʹ
    Ϗϧυ͢Δํࣜ
    •  %PLLVΈ͍ͨͳ
    σϞͬͨͷ͸ͷ΄͏

    View full-size slide

  21. #VJMEQBDL
    •  ΞϓϦέʔγϣϯͷ࣮ߦ؀ڥΛϏϧυ͢
    ΔͨΊͷεΫϦϓτύοέʔδ
    – ΠϯλϑΣʔε͕ඪ४Խ͞ΕͯΔ
    •  CJOEFUFDUŋŋŋର৅ΞϓϦͷݴޠͳͲΛ൑ఆ
    •  CJODPNQJMFŋŋŋ࣮ߦʹඞཁͳ؀ڥΛϏϧυ
    –  ྫSVCZͷϏϧυɺCVOEMFJOTUBMMFUD
    •  CJOSFMFBTFŋŋŋΞϓϦέʔγϣϯ࣮ߦίϚϯυ
    ͷܾఆ
    –  IFSPLVIFSPLVCVJMEQBDLSVCZ IFSPLVIFSPLV
    CVJMEQBDLOPEFKT NJZBHBXBIFSPLVCVJMEQBDL
    QFSMͦΕͧΕʹͭͷεΫϦϓτ͕ೖͬͯΔ

    View full-size slide

  22. 1.  アプリ を  
    git  push
    2.  post-­‐update  hoook  で  
    docker  run  
    3.  コンテナ起動
    4.    アプリを  git  clone (※cloneじゃなくpushにしたい)

    View full-size slide

  23. ΞϓϦͷHJUDMPOFޙ
    •  EPDLFSSVOͰΞϓϦέʔγϣϯίʔυ
    ʹରͯ͠CVJMEQBDLΛద༻
    – CJOEFUFDUͰ൑ఆ͠USVF͕ฦͬͨΒɺͦ
    ͷCVJMEQBDLͷCJODPNQJMFͰϏϧυ
    – CJOSFMFBTFͰܾఆ͞Ε࣮ͨߦίϚϯυΛ
    FYFD

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  27. Ͱ΋ɺͪΐͬͱ଴ͯΑ
    •  %PDLFS͸Πϝʔδ࡞ͬͯίϯςφىಈ͢
    Δͷ௒؆୯͡ΌΜ
    – CVJMEQBDLํࣜ͸ॊೈ͚ͩͲɺͦͷॊೈੑ
    ཁΔ
    – SVCZ༻ΠϝʔδɺOPEFKT༻Λ࡞͓͍ͬͯͯɺ
    ಈ͔͢΋ͷʹ߹ΘͤͯΠϝʔδΛબ୒ͯ͠
    SVO͢Δํ͕ࣜ୯७׌ָͭͩͬͨ

    View full-size slide

  28. Ωϡʔ˓ʔ෼ΫοΩϯάํࣜ
    •  ʮ͜͜ͰSVCZCVOEMFS͕ඞཁ
    ʹͳΓ·͕͢ŋŋŋ͋Β͔͡Ί࡞͓͖ͬͯ·
    ͨ͠ʯ
    %PDLFSͳΒ࡞Γஔ͖؆୯ɻ
    %PDLFSϨϙδτϦͰڞ༗
    ΋0,

    View full-size slide

  29. ΞΠσΞ ·ͩ΋΍΋΍

    •  CVJMEQBDLతͳ%PDLFSJNBHFT
    – CVJMEQBDLͷEFUFDUͰ؀ڥΛ൑ఆ͠
    – ͦͷ؀ڥʹదͨ͠อଘࡁΈίϯςφΛબ୒͠
    – CVJMEQBDLͷSFMFBTFͷΑ͏ʹͦͷίϯς
    φʹܾΊΒΕͨૢ࡞Λ࣮ߦͤ͞Δ
    CVJMEQBDLͰϏϧυͨ͠
    ίϯςφΛDPNNJUͯ͠
    ࠶ར༻ɺͱ͔Ͱ΋͍͍͔

    View full-size slide

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

    View full-size slide

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

    View full-size slide