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

Brief description of Docker and XaaS in the AI era

Brief description of Docker and XaaS in the AI era

Hidenori Matsuki

May 23, 2019
Tweet

More Decks by Hidenori Matsuki

Other Decks in Technology

Transcript

  1. ࠓ೔ͷ͓࿩ • Dockerͷ࿩ • ศར͞ͷ֬ೝʙMLฤʙ • Dockerͬ͘͟Γཧղ • Docker ComposeͰ΋ͬͱศརʹ

    • DockerfileʢͪΐͬͱʣϕετϓϥΫςΟε • XaaSʢβʔεʣͷ࿩ • ਎ۙͳXaaS • DockerͰGPUΛ࢖͏ͨΊͷIaaSͱIaC 3
  2. ँࣙʗࢀߟࢿྉ ⏬ Λࢀߟʹ͍͖ͤͯͨͩ͞·ͨ͠ • ެࣜυΩϡϝϯτ https://docs.docker.com/ • ʮϚϯΨͰΘ͔ΔDockerʯγϦʔζ • #ϚϯΨͰΘ͔ΔDocker

    ᶃ https://llminatoll.booth.pm/items/825879 • #ϚϯΨͰΘ͔ΔDocker ᶄ https://llminatoll.booth.pm/items/1036317 • DockerΛࢧ͑Δٕज़ https://www.amazon.co.jp/dp/B00VHW3PKW 10
  3. Docker͸ɾɾɾʁ • “ίϯςφΠϝʔδ”ͷ࡞੒ɺڞ༗ɺ࣮ߦ͕Ͱ͖Δ • “Securely build, share and run any

    application, anywhere” • by https://www.docker.com/ • ͢Ͱʹଟ͘ͷίϯςφΠϝʔδ͕ڞ༗͞Ε͍ͯΔ • https://hub.docker.com/ ͳͲͰڞ༗Մೳ • ྫ: https://hub.docker.com/r/tensorflow/tensorflow/tags • ίϯςφΠϝʔδ͸શͯʮ࣮ߦՄೳͳLinuxʢͷίϯςφʣ؀ڥʯ 14
  4. Dockerͬ͘͟Γཧղ • “Linuxίϯςφ”ͱ͸ʁ ▶ ࣍ͷϖʔδͰਤΛ঺հ͠·͢ • ίϯςφͱ͸ҎԼͷ෼཭ • ϓϩηεۭؒ, ϑΝΠϧγεςϜ,

    ωοτϫʔΫ, ܭࢉϦιʔεʢCPU, Memʣ • VirtualBoxͷΑ͏ͳԾ૝ϚγϯʢVMʣͰ͸ͳ͍ • VM͸จࣈ௨Γϋʔυ΢ΣΞͷந৅Խ • pipͷΑ͏ͳιϑτ΢ΣΞύοέʔδͰ͸ͳ͍ • ιϑτ΢ΣΞύοέʔδ͸͋͘·Ͱʢ࣮ߦՄೳϑΝΠϧΛؚΉʣσʔλ • venvͷΑ͏ͳ؀ڥ੾Γସ͑πʔϧͰ͸ͳ͍ • ؀ڥ੾Γସ͑πʔϧ͸ओʹ؀ڥม਺ͳͲΛ੾Γସ͍͑ͯΔ 16
  5. Container Runtime Process(es) bin lib Container Runtime Process(es) bin lib

    Container Runtime Process(es) bin lib Container Runtime Process(es) bin lib Dockerͬ͘͟Γཧղ 17 HW OS OS(Guest) OS(Host) HW HyperVisor pip ͳͲ ෺ཧϚγϯ্ͰVMΛհͣ͞ʹ ίϯςφΛಈ͔͢͜ͱ΋Մೳ Docker for Mac, GKEͳͲ͸ VM্ͰίϯςφΛಈ͔͍ͯ͠Δ VirtualBox ͳͲ
  6. Dockerͬ͘͟Γཧղ • ࣮͸ίϯςφ≠Docker • DockerҎ֎ͷίϯςφٕज़΋͋Δ(LXC, Solaris Containers, etc.) • Ͱ͕͢ࠓ೔͸Dockerͷ࿩͚ͩ

    • Docker͸LinuxͷϦιʔε෼཭ػೳ(namespace)Λ࢖༻ • Mount namespace, PID namespace, etc. • https://en.wikipedia.org/wiki/Linux_namespaces • ͳͷͰDocker for Mac͸macOS্ͷLinux্Ͱಈ͍͍ͯΔ • https://blog.docker.com/2016/03/docker-for-mac-windows-beta/ 18
  7. Dockerͬ͘͟Γཧղ • Ͳ͏΍ͬͯΠϯετʔϧ͢Ε͹͍͍ͷʁ on macOS • ࣮͸⬇ ͷ2ίϚϯυ͚ͩͰΠϯετʔϧͰ͖·͢ • /usr/bin/ruby

    -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/ master/install)" • brew cask install docker • ࢀߟ: https://brew.sh/ 19
  8. Docker ComposeͰ΋ͬͱศརʹ • Docker Composeͱ͸ʁ • ෳ਺ͷίϯςφΛ؅ཧͰ͖Δπʔϧ • Կ͕Ͱ͖Δͷʁ •

    ʢ౰વʣෳ਺ίϯςφͷ؅ཧ • ྫ: WebΞϓϦέʔγϣϯ։ൃͰϑϩϯτΤϯυ, αʔόʔαΠυ, DBΛಉ࣌ʹىಈ • mazgi-showcase/docker-compose.webapp-dev-envs/blob/2019.04.0/rails-webapp/ docker-compose.yml • ࠓ೔͸͋·Γ৮Ε·ͤΜ • ίϚϯυϥΠϯҾ਺ͷఆٛͱ؅ཧ • ʮdocker run …ͳΜ͚ͩͬʯͬͯͳΔ͜ͱͳ͍Ͱ͔͢ʁ • ͦΕɺYAMLܗࣜͰఆٛͰ͖·͢ɺ΋ͪΖΜGitͰόʔδϣϯ؅ཧՄೳ 21
  9. ਎ۙͳXaaS • XaaS == Anything as a ServiceɺIaaS, FaaS, SaaS

    ͳͲͷ૯শ • IaaS == Infrastructure as a Service • αʔόʔϋʔυ΢ΣΞͷαʔϏεԽ • Ϣʔβʔ͸OSͱωοτϫʔΫΛѻ͑Δ • FaaS == Function as a Service • ʢϓϩάϥϛϯάతҙຯͷʣؔ਺࣮ߦ؀ڥͷαʔϏεԽ • Ϣʔβʔ͸ؔ਺Λఆ࣮ٛ͠ߦͰ͖Δ • SaaS == Software as a Service • ΞϓϦέʔγϣϯͷαʔϏεԽ • Ϣʔβʔ͸ʢWebϒϥ΢βӽ͠ʹʣܾ·ͬͨΞϓϦέʔγϣϯΛ࢖༻Ͱ͖Δ 33
  10. ??? Process(es) bin lib ??? Process(es) bin lib ਎ۙͳXaaS 34

    OS(Guest) OS(Host) HW HyperVisor ??? Process(es) bin lib Data IaaS FaaS SaaS VMҎԼΛ͓೚ͤ ΞϓϦ࣮ߦ؀ڥ·Ͱ͓೚ͤ σʔλҎ֎શ෦͓೚ͤ Gmail AWS Lambda Cloud Functions Google Calendar AWS EC2 GCP GCE ౰વϋʔυ΢ΣΞ͕ ͋Δ”͸ͣ”ɻ ͖ͬͱLinuxͳͲ͕ ಈ͍͍ͯΔ”͸ͣ”ɻ ΋͸΍Ϣʔβʔ͔Β͸ ࢓૊Έ͕ݟ͑ͳ͍ɻ
  11. DockerͰGPUΛ࢖͏ͨΊͷIaaSͱIaC • IaC == Infrastructure as Code • ʮΠϯϑϥΛίʔυͰఆٛ͢Δʯߟ͑ํ •

    ίʔυͳͷͰ • όʔδϣϯ؅ཧͰ͖Δ • ෳ੡Ͱ͖Δ • ܁Γฦ͠΍෼ذ͕Ͱ͖Δʢݶఆతʣ • ଟ͘ͷπʔϧ͕͋Δ 41
  12. DEMO DockerͰGPUΛ࢖͏ͨΊͷIaaSͱIaC • αϯϓϧʢ࠶ܝʣ • https://github.com/mazgi/terraform-aws-simple-vpc/tree/v2019.05.2/examples/ simple-ml • ࠓճͷDemo ▶

    ࣍ͷϖʔδͰߏ੒ਤΛ঺հ͠·͢ • TerraformͰAWSΛઃఆ͢Δ • ಈը ▶ https://www.youtube.com/watch?v=aJiaQASr0G4 • AWSఏڙͷDeep LearningΠϝʔδ͔ΒԾ૝ϚγϯΛىಈ͢Δ • Ծ૝ϚγϯʢVMʣ΁ͷSSH઀ଓݩΛ೚ҙͷIPΞυϨεʹݶఆ͢Δ • VM্ͰDocker Composeͱnvidia-docker 2Λ࢖ͬͯTensorFlowίϯςφΛىಈ͢Δ • ϩʔΧϧ͔ΒWebϒϥ΢βͰDockerίϯςφ্ͷJupyter Notebookʹ઀ଓ͢Δ 42