$30 off During Our Annual Pro Sale. View Details »

docker-with-packer

 docker-with-packer

Web Tech Tokyo #1 (Docker Tips 共有会)
PackerでちゃんとDockerする!

資料中の関連資料一覧

ref. 1コマンドで本番サーバと開発サーバ (のVMイメージ)を作る話に移行した話, 2016-07-08
http://tech.vasily.jp/entry/create-prod-and-dev-vm-image-atst-by-packer

ref. EB with multi-container Docker をproductionで1年間運用して起きたこと, 2016-06-27
https://speakerdeck.com/tknzk/eb-with-multi-container-docker

ref. ElasticBeanstalk w/ multi-container docker 最新事情, 2016-08-29
http://tech.vasily.jp/entry/ecr_secondary_docker_registry

ref. AndroidのCI環境をCircleCIからWerckerに移行しました, 2016-06-15
http://tech.vasily.jp/entry/migrate_android_ci_from_circleci_to_wercker

Tatsuro Mitsuno

October 12, 2016
Tweet

More Decks by Tatsuro Mitsuno

Other Decks in Technology

Transcript

  1. 7"4*-: *OD
    1BDLFSͰ
    ͪΌΜͱ%PDLFS͢Δʂ
    8FC5FDI5PLZP

    ʢ%PDLFS5JQTڞ༗ձʣ

    View Slide

  2. 7"4*-: *OD
    ࣗݾ঺հ
    wޫ໺ୡ࿕5BUTVSP.JUTVOP !LPUBUTV

    w7"4*-: *OD*OGSB&OHJOFFS

    w҆ͯ͘଎ͯ҆͘શͳΠϯϑϥΛ࡞Δ
    wੜ࢈ੑΛ޲্ͤ͞ΔऔΓ૊Έ झຯ

    *DPOJMMVTUSBUFECZ:04)*
    IUUQTXXXGBDFCPPLDPNZPTIJZPOF

    View Slide

  3. 7"4*-: *OD

    View Slide

  4. 7"4*-: *OD
    ຊ୊1BDLFSͰʮͪΌΜͱʯ%PDLFS͢Δʂ
    XJUI

    View Slide

  5. 7"4*-: *OD
    લஔ͖ฐࣾͷΠϯϑϥࣄ৘
    SFGίϚϯυͰຊ൪αʔόͱ։ൃαʔό ͷ7.Πϝʔδ
    Λ࡞Δ࿩ʹҠߦͨ͠࿩
    ΄΅౳͍͠
    ؀ڥΛ࣮ݱ
    7.ΠϝʔδΛ

    ूத؅ཧɾಉ࣌ੜ੒
    EFW
    QSPE

    View Slide

  6. 7"4*-: *OD
    લஔ͖ฐࣾͷΠϯϑϥࣄ৘
    SFGίϚϯυͰຊ൪αʔόͱ։ൃαʔό ͷ7.Πϝʔδ
    Λ࡞Δ࿩ʹҠߦͨ͠࿩
    EPDLFSΠϝʔδ͚ͩಛผѻ͍͠ͳ͍ӡ༻ମ੍ͷߏங
    ຊൃදͷൣғ
    7.ΠϝʔδΛ

    ूத؅ཧɾಉ࣌ੜ੒
    EFW
    QSPE

    View Slide

  7. 7"4*-: *OD
    ෆ҆1BDLFSͰʮͪΌΜͱʯ%PDLFSͰ͖Δ͔ʁ
    ʮͪΌΜͱʯ%PDLFSpMFͱಉ౳ͷࣄ͕Ͱ͖Δࣄ

    View Slide

  8. 7"4*-: *OD
    ͖ͬͱΑΏʔͬ͢Α
    ˜PLBEBQBO

    View Slide

  9. 7"4*-: *OD
    ͩΊͰͨ͠
    ˜PLBEBQBO

    View Slide

  10. ʢҙ༁ʣQBDLFSͰEPDLFSΠϝʔδ࡞Δඞཁ͋Δʁ

    ίΞػೳͳ͍͡ΌΜ
    ʢҙ༁ʣྑ͍࣭໰Ͱ͢Ͷɻ

    View Slide

  11. 7"4*-: *OD
    ੍໿ϝλσʔλͷදݱ͕Ͱ͖ͳ͍
    %PDLFSpMFͷॻࣜ දݱՄೳ͔ʁ
    උߟ
    '30.
    36/ QSPWJEFSͰදݱ
    "%% QSPWJEFSͰදݱ
    $01: QSPWJEFSͰදݱ
    0/#6*-% QSPWJEFSͰදݱ
    4)&-- ❓ TIFMMQSPWJEFSͷJOMJOF@TIFCBOHͰදݱʁ
    ."*/5"*/&3 $.% -"#&- 

    &9104& &/7 &/53:10*/5 

    70-6.& 64&3 803,%*3 

    "3( 45014*(/"- 

    )&"-5)$)&$,

    View Slide

  12. 7"4*-: *OD
    ࢼߦࡨޡ
    w %PDLFSpMFΛ1BDLFSʹಡΈࠐ·ͤΔํ๏Λௐࠪ
    w %PDLFSͷϝλσʔλ֨ೲ৔ॴΛίʔυ͔Β௥੻
    w 1BDLFSͱ%PDLFSpMFΛγΣϧεΫϦϓτͰғΜͰݟΔ
    w

    View Slide

  13. 7"4*-: *OD
    ࠷ऴతʹϓϥάΠϯΛ࠾༻
    wQBDLFSQPTUQSPDFTTPSEPDLFSEPDLFSpMF
    wઌఔͷJTTVFͰొ৔

    View Slide

  14. 7"4*-: *OD
    ಺෦Ͱ%PDLFSpMFΛੜ੒࣮ͯ͠ߦ
    {
    "type": "docker-dockerfile",
    "volume": ["/data"]
    "expose": [8080],
    "cmd": ["bash"],
    "env": {
    "FOO": "bar"
    }
    }

    View Slide

  15. 7"4*-: *OD
    "RepoTags": [
    "nginx-test:latest"
    ],
    "DockerVersion": "1.12.1",
    "Author": "Tatsuro Mitsuno (@kotatsu360)",
    "Config": {
    "User": "vasily",
    "ExposedPorts": {
    "443/tcp": {},
    "80/tcp": {}
    },
    "Env": [
    "PATH=/usr/local/sbin: ...",
    "VASILY=YEAH"
    ],
    "Cmd": [
    "nginx",
    "-g",
    "daemon off;"
    ]
    }
    "post-processors": [
    [
    {
    "type": "docker-tag",
    "repository": "nginx-test",
    "tag":"latest"
    },
    {
    "type": "docker-dockerfile",
    "maintainer": "Tatsuro Mitsuno (@kotatsu360)",
    "user": "vasily",
    "expose": [80, 443],
    "cmd": ["nginx", "-g", "daemon off;"],
    "env": {
    "VASILY": "YEAH"
    }
    }
    ]
    ]
    QBDLFS༻ͷKTPOͷҰ෦ EPDLFSJOTQFDUͷҰ෦

    View Slide

  16. 7"4*-: *OD
    1SPT
    wίϯςφͷ࡞੒Λ1BDLFSͷ+40/ʹू໿

    ϝλσʔλͷએݴ΋ग़དྷΔ

    View Slide

  17. 7"4*-: *OD
    $POT
    w݁ہ%PDLFSpMFΛॻ͘ͷͱେࠩͳ͍

    ͋ͱ͸ϙϦγʔͷ໰୊ɹू໿PSྲّྀʹै͏

    View Slide

  18. 7"4*-: *OD
    ಋೖʹؔͯ͠஫ҙ
    w%PDLFSWҎ߱Λ࢖͏ͳΒSP[IBࢯʹΑΔGPSL൛͕Φεεϝ

    IUUQTHJUIVCDPNSP[IBQBDLFSQPTUQSPDFTTPSEPDLFSEPDLFSpMFUSFF
    W
    wEPDLFSUBHͷGΦϓγϣϯഇࢭʹ൐͏मਖ਼ΛؚΉ

    IUUQEPDTEPDLFSKQFOHJOFEFQSFDBUFEIUNMEPDLFSUBHG
    w13ʹ΋ͳ͍ͬͯΔͷͰ͍ۙ͏ͪʹऔΓࠐ·Εͦ͏

    IUUQTHJUIVCDPNDPSOGFFEIPCPQBDLFSQPTUQSPDFTTPSEPDLFS
    EPDLFSpMFQVMM

    View Slide

  19. 7"4*-: *OD
    ·ͱΊ
    w1BDLFSͰʮͪΌΜͱʯ%PDLFSΠϝʔδΛ࡞Δํ๏Λ঺հ
    wݱঢ়ɺ1BDLFS୯ମͰ͸ʮͪΌΜͱʯ%PDLFS͢Δͷ͸ແཧ
    wϓϥάΠϯͰϑΥϩʔ͢Δ͜ͱͰ࣮ݱՄೳ
    wखؒ͸%PDLFpMFͱ͋·ΓมΘΒͳ͍

    View Slide

  20. 7"4*-: *OD
    ิ଍ฐࣾͷ%PDLFSࣄ৘
    ΞϓϦέʔγϣϯαʔό

    ࠓ೔ͷ࿩

    ຊ൪౤ೖલͷݕূத

    %PDLFSXJUI1BDLFS

    "%഑৴αʔό

    ຊ൪ӡ༻ʙ

    BMQJOFϕʔε

    &MBTUJD#FBOTUBMLXJUINVMUJDPOUBJOFS
    SFGXJUINVMUJDPOUBJOFS%PDLFSΛQSPEVDUJPOͰ೥ؒӡ༻ͯ͠ى͖ͨ͜ͱ
    SFG&MBTUJD#FBOTUBMLXNVMUJDPOUBJOFSEPDLFS࠷৽ࣄ৘
    "OESPJEΞϓϦͷ$*؀ڥ

    ຊ൪ӡ༻ʙ

    VCVOUVϕʔε

    %PDLFSPO8FSDLFS
    SFG"OESPJEͷ$*؀ڥΛ$JSDMF$*͔Β8FSDLFSʹҠߦ͠·ͨ͠

    View Slide

  21. 7"4*-: *OD
    8FBSFIJSJOH
    IUUQTXXXXBOUFEMZDPNDPNQBOJFTWBTJMZJOGP
    ˜PLBEBQBO

    View Slide