Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Docker入門
Search
imtnd
April 24, 2016
Technology
0
980
Docker入門
NaITE 13回目勉強会 Docker入門 資料
imtnd
April 24, 2016
Tweet
Share
More Decks by imtnd
See All by imtnd
グローバルなソフトウェアテスト組織における課題と戦略 / Challenges and Strategies in a Global Software Testing Organization #mf_techday
imtnd
0
370
WACATE 2022 夏 ワークショップの目的
imtnd
0
970
テスト設計技法をなぜ&どのように使うのか体験しよう!
imtnd
0
1.5k
analyze the behavior with decision table
imtnd
0
4k
WACATE流テスト分析のワークショップを体感してみよう
imtnd
0
210
テスト技法作成のアプローチを考える
imtnd
0
720
テストの目的を考えよう
imtnd
0
800
アジャイルとテスト / Agile and Testing
imtnd
1
1.9k
やってみよう状態遷移テスト #xpjug
imtnd
0
1k
Other Decks in Technology
See All in Technology
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
280
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
400
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
270
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
podman_update_2024-12
orimanabu
1
280
なぜCodeceptJSを選んだか
goataka
0
160
Wantedly での Datadog 活用事例
bgpat
1
530
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
270
APIとはなにか
mikanichinose
0
100
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
Navigating Team Friction
lara
183
15k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Six Lessons from altMBA
skipperchong
27
3.5k
Producing Creativity
orderedlist
PRO
341
39k
A Philosophy of Restraint
colly
203
16k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Transcript
Docker ೖ NaITE #13 2016.4.27
ࣗݾհ ໊લɿ֯ాɹढ़ʢͭͷͩɹ͠ΎΜʣ ίϛϡχςΟɿNaITEɹͳͲ Twitterɿ͍ΉͯΜˏimtnd ۈઌɿ௨৴ܥۀ ۀɿιϑτΣΞ։ൃɹ5
Docker
ຊηογϣϯͷత DockerΛͳΜͱͳ͘ཧղ͢Δ DockerΛ࠷ݶ͑ΔΑ͏ʹͳΔ
Docker
Dockerʹ͍ͭͯ DockerͱɺԾԽٕज़ͷҰͭ ίϯςφͱ͍͏୯ҐͰԾԽ͢Δ͜ͱʹΑΓɺ OSͳͲʹґଘ͠ͳ͍γεςϜΛఏڙ
Dockerʹ͍ͭͯ Virtual Machine container https://www.docker.com/what-docker
DockerͷϝϦοτ VMͱҧ͍ܰྔͰ͋Γɺىಈɺऴ͕ྃߴͰ ͋Δ CIͳͲͰ͍ࣺͯͳ͕ΒΫϦʔϯͳڥͰς ετ͢Δ͜ͱ͕Ͱ͖Δ ύοέʔδΠϝʔδ͕ڞ༗Ͱ͖ɺ͙͢ʹ༻ ͢ΔΈ͕͋Δ
Docker Toolbox
Docker Toolbox Dockerʹؔ࿈͢Δπʔϧ͕ύοέʔδԽ͞Ε ͨͷ Docker Engine Docker Machine Docker Compose
Kitematic
DockerͷΠϯετʔϧํ๏ Cent OS 7 Ҏ্ yum ͰΠϯετʔϧՄೳ Ubuntu 15.04 Ҏ্
ύοέʔδΛՃͯ͠ɺapt-getͰΠϯε τʔϧՄೳ https://docs.docker.com/engine/installation/linux/ubuntulinux/
DockerͷΠϯετʔϧํ๏ ίϯςφઐ༻OS https://coreos.com/using-coreos/containers/
DockerͷΠϯετʔϧํ๏ ίϯςφઐ༻OS CoreOS Project Atomic Red Hat Enterprise Linux Atomic
Host Snappy Ubuntu Core
DockerͷΠϯετʔϧํ๏ WindowsɺMac OSͷ߹ Virtual Box Docker Toolbox ※ɹ2016/04/27ݱࡏͷϝδϟʔͳํ๏
DockerͷΠϯετʔϧํ๏ MacOSͱWindowsͷωΠςΟϒԾԽΛ༻͍ͨ Docker७ਖ਼πʔϧʮDocker for Mac/Windowsʯొɺ VirtualBoxෆཁʹ http://www.publickey1.jp/blog/16/docker_for_macwindows.html
WindowsɺMac OSͰԿߟ͑ͳ͍ͰΠϯε τʔϧ͢ΔͱɺVIrtual Box্ʹ”default”ͱ͍ ͏ԾϚγϯ͕Ͱ͖͍ͯΔ Linuxͷ߹ίϚϯυͰɺDocker༻ͷԾ ϚγϯΛ࡞͢Δ DockerͷΠϯετʔϧํ๏
Docker Machine
Docker Machine Docker ϗετΛϚωδϝϯτ͢Δπʔϧ Docker ϗετͷ࡞ Docker ϗετͷىಈ Docker ϗετͷऴྃɹɹɹͳͲ
Docker MachineίϚϯυ Docker MachineΛVirtual Box্ʹ࡞ Docker Machineͷআ $docker-machine create —driver
virtualbox vmD(ԾϚγϯ໊) $docker-machine rm vmD(ԾϚγϯ໊)
Docker MachineίϚϯυ Dockerϗετͷىಈ Dockerϗετͷऴྃ DockerϗετͷҰཡදࣔ $docker-machine start default(ԾϚγϯ໊) $docker-machine stop
default(ԾϚγϯ໊) $docker-machine ls
Docker MachineίϚϯυ DockerϗετͷIPΞυϨε֬ೝ DockerϗετͷϩάΠϯ Dockerϗετͷڥม֬ೝ $docker-machine ip default(ԾϚγϯ໊) $docker-machine ssh
default(ԾϚγϯ໊) $docker-machine env default(ԾϚγϯ໊)
DockerίϚϯυ DockerͷΠϝʔδͷऔಘ $docker pull centos:centos6 ϦϙδτϦ໊ λά
DockerίϚϯυ $docker pull centos:centos6 DockerϨδετϦʹ ެ։͞Εͨ DockerΠϝʔδ pull
DockerϨδετϦ DockerϨδετϦͱɺDockerͷΠϝʔδΛ ཧ͓ͯ͘͠ॴ ެࣜͰ༻ҙ͍ͯ͠ΔDockerϨδετϦ Docker Hub https://hub.docker.com/
DockerίϚϯυ Docker ΠϝʔδͷҰཡදࣔ Docker Πϝʔδͷআ $docker images $docker rmi centos:centos6(ϦϙδτϦ໊:λά)
DockerίϚϯυ Cent OSͷDockerΠϝʔδΛಈ͔ͯ͠ΈΔ $docker run -t -i —name centos centos:centos6
/bin/bash ίϯςφ໊Λ͚ΒΕΔ
DockerίϚϯυ Docker ίϯςφͷҰཡදࣔ Docker ίϯςφͷআ $docker ps -a $docker rm
centos6(ίϯςφ໊)
DockerίϚϯυ nginx(ΤϯδϯΤοΫε)ͷΠϝʔδऔಘ ϙʔτʹׂΓ͚ͯىಈ $docker pull nginx:latest $docker run -d -p
8080:80 —name nginx nginx:latest WebαʔόΛಈ͔ͯ͠ΈΔ
DockerίϚϯυ Docker ίϯςφͷऴྃ Docker ίϯςφͷىಈ $docker stop nginx(ίϯςφ໊) $docker start
nginx(ίϯςφ໊)
Dockerfile DockerfileͱɺDockerΠϝʔδΛ࡞͢Δ ݩͱͳΔϑΝΠϧ makeϑΝΠϧͷΑ͏ͳͰɺҰίϚϯυͰ DockerΠϝʔδ͕࡞ग़དྷΔ ؆୯ʹهड़Ͱ͖ɺݟͨཧղ͍͢͠ͷ͕ ಛ
Dockerfile Dockerfileαϯϓϧ $git clone https://github.com/imtnd/httpd.git httpd +- Dockerfile +- index.html
※ɹGit͕ͳ͍ਓϒϥβ͔ΒΞΫηε
Dockerfile httpdσΟϨΫτϦʹҠಈ $cd httpd DockerfileΛݩʹDockerΠϝʔδͷ࡞ $docker build -t httpd ./
Dockerfile ίϯςφͷىಈ $docker run -d -p 80:80 httpd(ϦϙδτϦ໊) ϒϥβͰϗετͷIPΞυϨεʹΞΫηε͠ ͯΈΔͱɺ”hello
docker”ͱݟ͑Δ
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"] ϕʔεͷDockerΠϝʔδ
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"] DockerΠϝʔδ࡞ऀ
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"] ίϚϯυͷ࣮ߦࢦࣔ
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"] ϑΝΠϧͷՃࢦࣔ
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"] ϙʔτ൪߸ͷొ
Dockerfile FROM centos:centos6 MAINTAINER imtnd RUN yum install -y httpd
ADD index.html /var/www/html/index.html EXPOSE 80/tcp CMD ["/usr/sbin/httpd","-D","FOREGROUND"] ίϯςφىಈ࣌ͷ ࣮ߦίϚϯυࢦࣔ
Docker Compose
Docker Compose ίϯςφαʔϏε୯ҐͰߏங͍ͯ͘͠ͱ ཧָ͕ʹͳΔʢΞϓϦɺDBͳͲʣ αʔϏεෳͷίϯςφʹΑͬͯߏங͞Ε Δ͜ͱʹͳΔͨΊҰׅͰཧ͢Δඞཁ͕͋Δ ෳͷίϯςϯΛཧग़དྷΔΈ͕ɺ Docker Compose
Docker Compose Docker ComposeɺYMLϑΝΠϧͰίϯςφΛཧ ͢Δ YMLϑΝΠϧαϯϓϧ(TestLinkͱ͍͏αʔϏε͕ಈ͘) $git clone https://github.com/imtnd/testlink_yml.git ※ɹGit͕ͳ͍ਓϒϥβ͔ΒΞΫηε
Docker Compose YMLϑΝΠϧΛݩʹαʔϏεΛىಈ ίϯςφͷঢ়ଶ֬ೝ $docker-compose up -d $docker-compose ps ԼهΞυϨεʹϒϥβ͔ΒΞΫηϧͰ͖Δ
http://xxx.xxx.xxx.xxx(ϗετͷIPΞυϨε)/testlink/ ॳظઃఆͳͲԼهαΠτΛࢀর http://qiita.com/imtnd/items/a58a707db08c3710d963
Docker Compose αʔϏεͷఀࢭ $docker-compose stop ҰίϚϯυͰɺMySQLɺTestLinkͷαʔϏε ͷίϯςφ͕ىಈͯ͠Δɻ busyboxͱ͍͏ͷɺσʔλΛӬଓԽ͢Δͨ Ίͷίϯςφ
Docker Compose Docker hubʹ͋ΔΠϝʔδΛ༻͢Δͱ໘ ͍͘͞ΠϯϑϥߏஙΛ͠ͳ͍ͰɺڥΛηοτ Ξοϓ͢Δ͜ͱ͕Ͱ͖Δɻ ڵຯΛ࣋ͬͨπʔϧΛ؆୯ʹ༻ͯ͠Έ͍ͨ࣌ ͳͲʹ࠷ద (πʔϧ໊)ɹdocker compose
ͦͷଞπʔϧ Docker Swarm Docker Registory Kitematic
ίϯςφؔ࿈αʔϏε tutum Kubernates
࠷ޙʹ Docker ·ͩ·ͩ·ͩ·ͩൃల్தͳπʔ ϧͰ͢ɻ ͜ͷεϥΠυͷใաڈͷʹͳ͍͖ͬͯ ·͢ɻ ൃల్தͰ͋Δ͕ނʹɺ࠷৽ಈΛͬͯΈ Δͱ໘ന͍ͱࢥ͍·͢ɻ
Let’s Run Container