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
970
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
330
WACATE 2022 夏 ワークショップの目的
imtnd
0
950
テスト設計技法をなぜ&どのように使うのか体験しよう!
imtnd
0
1.4k
analyze the behavior with decision table
imtnd
0
4k
WACATE流テスト分析のワークショップを体感してみよう
imtnd
0
200
テスト技法作成のアプローチを考える
imtnd
0
710
テストの目的を考えよう
imtnd
0
780
アジャイルとテスト / Agile and Testing
imtnd
1
1.9k
やってみよう状態遷移テスト #xpjug
imtnd
0
1k
Other Decks in Technology
See All in Technology
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
Lexical Analysis
shigashiyama
1
150
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
630
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
180
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
260
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
180
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
450
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
AGIについてChatGPTに聞いてみた
blueb
0
130
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
230
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.3k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
RailsConf 2023
tenderlove
29
900
Facilitating Awesome Meetings
lara
50
6.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Happy Clients
brianwarren
98
6.7k
Agile that works and the tools we love
rasmusluckow
327
21k
GraphQLとの向き合い方2022年版
quramy
43
13k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
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