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

開発環境でdockerを使ってみた

9bd07df36e3b0ac50c126ad69ee0bffa?s=47 ta1kt0me
October 15, 2015

 開発環境でdockerを使ってみた

9bd07df36e3b0ac50c126ad69ee0bffa?s=128

ta1kt0me

October 15, 2015
Tweet

More Decks by ta1kt0me

Other Decks in Programming

Transcript

  1. Start to use Docker development environment 

  2. self • Work • Forkwell, Forkwell Jobs • GitHub •

    @ta1kt0me • Twitter • @talkto_me
  3. Docker

  4. ͖͔͚ͬ • werckerͷmigration࣌ɺΧϥϜ֦ு͢Δͱ Τϥʔ͕ى͖ͨ • Ewokʢdocker based stackʣΛ࢖ͬͯղܾ

  5. ͔ͤͬ͘DockerͷྲྀΕ͖ͨ͠

  6. ͱΓ͋͑ͣ࢖ͬͯΈ͍ͨ

  7. ·ͣ͸։ൃ؀ڥͰ

  8. ΍ͬͨ͜ͱ • docker-toolboxΛ࢖Θͳ͍ • docker-compose up͔͠࢖Θͳ͍ • υΩϡϝϯτ

  9. ΍ͬͨ͜ͱ • docker-toolboxΛ࢖Θͳ͍ • docker-compose up͔͠࢖Θͳ͍ • υΩϡϝϯτ

  10. docker-toolbox? Announcing Docker Toolbox http://blog.docker.com/2015/08/docker- toolbox/

  11. docker-toolbox? ؆୯Πϯετʔϥʔ • Docker Client • Docker Machine • Docker

    Compose • Docker Kitematic • VirtualBox
  12. ͳΜͰ࢖Θͳ͍ͷʁ • Docker Quickstart Terminal • Զͷ஌Βͳ͍Terminal্ཱ͕͕ͪΔ • ݁ߏ఍߅͋Δ

  13. /Applications/Docker/Docker Quickstart Terminal.app/Contents/ Resources/Scripts/start.sh

  14. start.sh • docker-machineͳ͔ͬͨΒ࡞ͬͯ • docker-machineىಈͯ͠ • eval $(docker-machine env $VM)

    machine͕ىಈ͍ͯ͠Ε͹eval͚ͩ͢Ε͹ྑ͛͞
  15. Կ͕ඞཁͳͷʁ

  16. खͰೖΕͯΈΔ brew install docker-machine brew install docker-compose

  17. docker-machine dockerͷϗετΛߏங͢Δπʔϧ $ docker-machine create --driver virtualbox default $ eval

    $(docker env default)
  18. tips • docker-machine create ͕ऴΘΒͳ͍ • docker-machine ίϚϯυͷ݁Ռ͕஗͍ • docker/machineͷissueΛݕࡧɺ50͙݅Β͍͋Δ

    • ࣗ෼ͷ৔߹͸ɺ#1684 Ͱղܾ https://github.com/docker/machine/search?p=1&q=docker- machine+create+hang&type=Issues&utf8=%E2%9C%93
  19. ΍ͬͨ͜ͱ • docker-toolbox࢖Θͳ͍ • docker-compose up͔͠࢖Θͳ͍ • υΩϡϝϯτ

  20. docker-compose ෳ਺ίϯςφΛ؅ཧͯ͠ҰͭͷαʔϏεͱ͠ ͯఏڙ͢Δπʔϧ

  21. docker-compose • ΞϓϦ͕ґଘ͢ΔπʔϧΛίϯςφʹҠߦ • ΞϓϦࣗମͷDockerfileΛ࡞Βͳ͍ • Docker͸։ൃ؀ڥͷબ୒ࢶ • ࠷ॳʹ֮͑Δ͜ͱ͸গͳ͍ํָ͕

  22. db: image: mysql ports: - "3306:3306" environment: MYSQL_ROOT_PASSWORD: root restart:

    always redis: image: redis ports: - "6379:6379" restart: always memcached: image: memcached ports: - "11211:11211" restart: always
  23. docker-compose $ docker-compose up -d 1ίϚϯυͰඞཁͳίϯςφ͕શ෦ىಈ ͳΜ͔ศརͦ͏ײ͋Δ

  24. ΍ͬͨ͜ͱ • docker-toolbox࢖Θͳ͍ • docker-compose up͔͠࢖Θͳ͍ • υΩϡϝϯτ

  25. υΩϡϝϯτେࣄ

  26. υΩϡϝϯτ • ಋೖखॱ͚ͩͰྑ͍ͷͰ͔ͬ͠Γॻ͘ • ϦϑΝϨϯεϖʔδͷURLΛࡌͤΔͱ਌੾ • ͍ͭͷؒʹ͔σϑΥϧτͷಋೖखॱʹ͢Δ

  27. ·ͱΊ • খ࢝͘͞ΊΔ • ศརײΞϐʔϧ • ಋ͘

  28. ͋Γ͕ͱ͏͍͟͝·ͨ͠