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
960
Docker入門
NaITE 13回目勉強会 Docker入門 資料
imtnd
April 24, 2016
Tweet
Share
More Decks by imtnd
See All by imtnd
WACATE 2022 夏 ワークショップの目的
imtnd
0
910
テスト設計技法をなぜ&どのように使うのか体験しよう!
imtnd
0
1.4k
analyze the behavior with decision table
imtnd
0
3.9k
WACATE流テスト分析のワークショップを体感してみよう
imtnd
0
190
テスト技法作成のアプローチを考える
imtnd
0
680
テストの目的を考えよう
imtnd
0
750
アジャイルとテスト / Agile and Testing
imtnd
1
1.9k
やってみよう状態遷移テスト #xpjug
imtnd
0
1k
Agile Japan 2019 Report
imtnd
0
1k
Other Decks in Technology
See All in Technology
Kubernetesって何? -大規模なKubernetesを運用するKubernetes as a Serviceチームの話を添えて-
lycorptech_jp
PRO
0
440
Next.js のページ遷移を全力で止める
ypresto
9
3.5k
Classmethod AI Talks(CATs) #1 司会進行スライド(2024.09.19) / classmethod-ai-talks-aka-cats_moderator-slides_vol1_2024-09-19
shinyaa31
0
230
『GRANBLUE FANTASY: Relink』専任エンジニアチームで回す大規模開発QAサイクル
cygames
0
110
DuckDB雑紹介(1.1対応版)@DuckDB座談会
ktz
6
1.4k
Creative UIs with Compose: DroidKaigi 2024
chrishorner
1
600
Segment Anything Model 2
tenten0727
3
720
LLVM/ASMを使った有限体の高速実装
herumi
0
120
Analytics-Backed App Widget Development - Served with Jetpack Glance
miyabigouji
0
630
Mocking in Rust Applications
taiki45
2
420
なにもしてないのにNew Relicのデータ転送量が増えていたときに確認したこと
tk3fftk
2
230
持続可能なソフトウェア開発を支える『GitHub CI/CD実践ガイド』
tmknom
8
1.4k
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.1k
The Invisible Customer
myddelton
119
13k
Making Projects Easy
brettharned
113
5.8k
Mobile First: as difficult as doing things right
swwweet
221
8.8k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
359
19k
Documentation Writing (for coders)
carmenintech
65
4.3k
4 Signs Your Business is Dying
shpigford
179
21k
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
Ruby is Unlike a Banana
tanoku
96
11k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
89
16k
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