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でドカドカ on FuraIT #36
Search
Aruneko
October 07, 2017
Technology
1
790
Dockerでドカドカ on FuraIT #36
FuraIT #36で発表したDocker勉強会の資料です。
ハンズオンで使用したファイルはこちら
https://github.com/aruneko/furait36_docker
Aruneko
October 07, 2017
Tweet
Share
More Decks by Aruneko
See All by Aruneko
RedmineをDockerに載せてみた
aruneko
1
2.3k
NFCとしゃべってみよう
aruneko
0
130
Haskell入門ハンズオン
aruneko
1
1.5k
北海道における学生ITコミュニティの紹介
aruneko
0
160
ゼロからわかるポインター
aruneko
0
970
ゆるいPython会
aruneko
0
240
Other Decks in Technology
See All in Technology
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
250
.NET 9 のパフォーマンス改善
nenonaninu
0
440
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
1
110
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
160
kargoの魅力について伝える
magisystem0408
0
200
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
420
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
23
11k
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Bash Introduction
62gerente
608
210k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
160
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Building Adaptive Systems
keathley
38
2.3k
A better future with KSS
kneath
238
17k
We Have a Design System, Now What?
morganepeng
51
7.3k
Why Our Code Smells
bkeepers
PRO
335
57k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Visualization
eitanlees
146
15k
Transcript
%PDLFSͰυΧυΧ 'VSB*5 XSJUUFOCZ"SVOFLP
ͱΓ͋͑ͣΠϯετʔϧ w ֤छσΟετϦʹEPDLFSύοέʔδͱͯ͠ొࡁΈ ͷͣ w ޙͰ͏ͷͰEPDLFSDPNQPTFύοέʔδಋೖ w 6CVOUVͱ"SDIͱNBD04Ͱͷྫ •
$ sudo apt install docker docker-compose • $ sudo pacman -S docker docker-compose • $ brew cask install docker
ϋϯζΦϯ༻ϑΝΠϧ w (JUIVCʹ্͛ͯ͋ΔͷͰΫϩʔϯPS;JQͰམͱ͍ͯͩ͘͠͞ w IUUQTHJUIVCDPNBSVOFLPGVSBJU@EPDLFS w ޙ΄Ͳ࣮ࢪ͢Δԋशͷ͑BOTXFSϒϥϯνʹ͋Γ·͢
ࣗݾհ w ͋ΔͶ͜ w -0$"-ֶੜ෦લ෦ w ࣨའۀେֶใઐ߈. w ֶͰ4".*5ͬͯ·͢ w
"SDI/FP7JN74$PEF)BTLFMM w ϥϘΫϥυαʔϏε 3FENJOFͳͲ ʹ%PDLFSΛ׆༻த
ࠓͷඪ w ٕज़త֓ཁ͕Θ͔Δ w %PDLFSpMFΛॻ͚ΔΑ͏ʹͳΔ w ίϯςφΛ࡞ΕΔΑ͏ʹͳΔ w .VMUJ4UBHF#VJME͕Ͱ͖ΔΑ͏ʹͳΔ w
ෆشൃੑσʔλΛѻ͑ΔΑ͏ʹͳΔ w DPNQPTF͕͑ΔΑ͏ʹͳΔ
%PDLFSͬͯʁ
ߦͰද͢ͱ w ΞϓϦέʔγϣϯΛ w ίϯςφʹด͡ࠐΊͯ w ۚଠ᷒తʹྔ࢈Ͱ͖ͯ w ͍ࣺͯΒΕΔ w
ͳΜ͔ศརͳϠπ
%PDLFSͷ׆༻ྫ
։ൃڥͱͯ͠ w ίϯςφͷίϐʔ͕༰қͳͨΊෳਓͰͷ։ൃڥڞ༗ʹศར w ڥͷҧ͍͕ຒ·ΓɺͦΕʹؔ࿈͢Δෆ۩߹ൃੜ͠ͳ͘ͳΔ w ίϯςφΛೖΕସ͑Δ͚ͩͰڥ͕όʔδϣϯΞοϓՄೳ
ຊ൪ڥͱͯ͠ w ٸͳΞΫηε૿ՃʹΑΔαʔόʔͷ૿ઃ؆୯ w όʔδϣϯΞοϓίϯςφΛೖΕସ͑Δ͚ͩʂ w Πϯϑϥཧ͕ςΩετϑΝΠϧͰՄೳ w (JUͰόʔδϣϯཧͰ͖ͪΌ͏
%PDLFSͷ͘͠Έ
%PDLFSͷ֓ཁ %PDLFS ίϯςφٕज़ ΤίγεςϜ
ԾԽͷҧ͍ )BSEXBSF )PTU04 7JSUVBM.BDIJOF)PTU (VTU04 1SPDFTT )BSEXBSF )PTU04 -JOVY,FSOFM %PDLFS%BFNPO
1SPDFTTPO$POUBJOFS ϗετܕԾԽ ίϯςφܕԾԽ
%PDLFSίϯςφ w ٕज़ͱͯ͠ผʹ৽͘͠ͳ͍ DISPPU KBJM TZTUFNEOTQBXOʜFUD w ಛͱݴͬͯ͜Μͳײ͡ w
ϓϩηε͕ϗετଆͱಠཱ w ωοτϫʔΫಠཱ w DISPPUͱಉ༷ίϯςφͷΈͷSPPUσΟϨΫτϦ w Ϣʔβʔಠཱ
ίϯςφͷਖ਼ମ %PDLFS$POUBJOFS *NBHF-BZFS$ *NBHF-BZFS# *NBHF-BZFS" 8SJUBCMF-BZFS %PDLFS*NBHF 3FBE0OMZ #BTF*NBHF 04
.JEEMFXBSF "QQMJDBUJPO
ίϯςφͷਖ਼ମ %PDLFS$POUBJOFS *NBHF-BZFS$ *NBHF-BZFS# *NBHF-BZFS" 8SJUBCMF-BZFS %PDLFS*NBHF 3FBE0OMZ )5.-ϑΝΠϧ /HJOY
6CVOUV ಈ࡞࣌ͷΩϟογϡ
%PDLFSΤίγεςϜ %PDLFS)VC -PDBM %PDLFS*NBHF" %PDLFS*NBHF# %PDLFS*NBHF$ %PDLFS*NBHF% %PDLFS*NBHF" /FX%PDLFS*NBHF औΓࠐΈ
ొ
%PDLFS)VC w IUUQTIVCEPDLFSDPN w %PDLFS*NBHFͷެࣜΞοϓϩʔυઌ w ࡞Γ͍ͨαʔϏεʹԠͨ͡ΠϝʔδΛݕࡧͯ͠ৄࡉΛ֬ೝ
ΤίγεςϜͱΠϝʔδ w ๛ͳ#BTF*NBHF w 6CVOUV $FOU04 "SDI-JOVY %FCJBO "MQJOF-JOVYʜFUD w
ෳͷ*NBHFؒͰ-BZFSΛڞ༗͢Δ͜ͱ͕Մೳ w μϯϩʔυ༰ྔͷઅ w ࣗ࡞ίϯςφొ࣌ͷΞοϓϩʔυ༰ྔͷઅ
ίϯςφΛ࡞ͬͯΈΔ
ॳظઃఆ w -JOVYͷਓҎԼͷखॱͰॳظઃఆ͍ͯͩ͘͠͞ w NBD04ͷਓෆཁͰ͢ w ࣗͷϢʔβʔΛ%PDLFSάϧʔϓʹॴଐ͓ͤͯ͘͞ w ͨͩ͠ࣄ্࣮ͷSPPUʹͳΔͷͰऔѻҙ •
$ sudo gpasswd -a USER_NAME docker w ऴΘͬͨΒ࠶ϩάΠϯͯ͠ɺ%PDLFSΛىಈ • $ sudo systemctl enable --now docker
TMίϯςφΛ࡞Ζ͏ʂ w ҰൃωλίϚϯυͰ༗໊ͳTMίϚϯυ͕ಈ͘ίϯςφΛ࡞Ζ͏ w ୯ͳΔΞϓϦέʔγϣϯͰɺอଘ͢Δͷ͕ͳ͍ͷͰ؆୯
ίϯςφ࡞ͷྲྀΕ w ίϯςφʹඞཁͳίϚϯυϑΝΠϧͷཧ w ཧͨ͠ίϚϯυ܈͔Β%PDLFSpMFͷॻ͖ى͜͠ w %PDLFSpMF͔ΒΠϝʔδΛੜ w Πϝʔδ͔ΒίϯςφΛىಈ
%PDLFSpMFΛॻ͜͏ w %PDLFSpMFɺڥߏஙͷखॱॻ w ϕʔεΠϝʔδͱͷ͚ࠩͩΛॻ͚ྑ͍ w ϑΝΠϧ໊֦ுࢠͳ͠ͷͣΓz%PDLFSpMFz w ͰશʹखॱΛѲ͍ͯ͠ͳ͍ͱ͍͖ͳΓॻ͚ͳ͍ w
ˠͱΓ͋͑ͣखॱΛ֬ೝ͢Δ
ςετ༻ίϯςφΛ࡞Δ w %PDLFSpMFʹ·ͱΊΔલͷςετ༻ίϯςφͰݕূ w ৭ʑ؆୯ͳͷͰήετ046CVOUVͰͬͯΈ·͢
%PDLFS*NBHFͷμϯϩʔυ • $ docker pull ubuntu:16.04 w ίϩϯΑΓޙΖͰΠϝʔδͷλάΛࢦఆͰ͖Δ w ֤ΠϝʔδͷλάͷҰཡ%PDLFS)VCͰ֬ೝ
ςετ༻ίϯςφͷىಈ • $ docker run -it --rm --name test ubuntu:16.04
Φϓγϣϯ આ໌ JU UUZΛ࡞ͬͯඪ४ೖྗΛͭͳ͙ SN ίϯςφऴྃ࣌ʹίϯςφΛআ OBNF ίϯςφʹ໋໊
4-ͷΠϯετʔϧ w ίϯςφͰBQUΛͬͯTMΛೖΕͯΈΔ w ύοέʔδ໊͕Θ͔Βͳ͍ͱ͖BQUͰ୳ͦ͏ w ೖΕऴΘͬͨΒɺIJTUPSZίϚϯυͰ࣮ߦͨ͠ίϚϯυΛ֬ೝ w %PDLFSpMFશࣗಈ࣮ߦ w
࣮ߦதͷϓϩϯϓτʹೖྗͰ͖ͳ͍ w ڧ੍ΠϯετʔϧΦϓγϣϯͳͲ BQUͷ߹Z ͕ඞਢͳͷͰҙ w ϨΠϠׂ͕͞ΕΔͱෆ߹͕͋ΔͷͰʮʯͰશίϚϯυΛͭͳ͙
%PDLFSpMFͷߏ w %PDLFSpMFͰΘΕΔ໋ྩͯ͢େจࣈ w ໋ྩͷޙʹҾΛεϖʔε۠ΓͰॻ͍͍ͯ͘ w ͪΐͬͱมΘͬͨγΣϧεΫϦϓτతͳ w ͓ΈͷΤσΟλͰʮ%PDLFSpMFʯΛ৽ن࡞͠Α͏
Α͘͏%PDLFSpMF໋ྩ ໋ྩ આ໌ '30. #BTF*NBHFͷࢦఆ 36/ -JOVYίϚϯυͷ࣮ߦ 803,%*3 DEͱಉ͡ʢଘࡏ͠ͳ͍σΟϨΫτϦࣗಈͰੜʣ $01:43$%45
43$͔Β%45ʹϑΝΠϧΛίϐʔ
%PDLFSpMFͷྫ FROM ubuntu:16.04 RUN apt update && \ apt install
-y sl && \ ln -s /usr/games/sl /usr/bin/sl
%PDLFSpMF͔ΒΠϝʔδΛ࡞ w %PDLFSpMF͕Ͱ͖ͨΒɺ͜ΕΛͬͯࣗ࡞ΠϝʔδΛ࡞ • $ docker image build -t sl
. w UɿΠϝʔδ໊Λ͚Δ w ࠷ޙͷʮʯɿ%PDLFSpMFͷ͋ΔσΟϨΫτϦͷ૬ରύε
ࣗ࡞Πϝʔδ͔ΒίϯςφΛੜ • $ docker container run -it -d --name sl_test
sl w Ұ൪࠷ޙͷҾʹͰ͖͕͋ͬͨࣗ࡞ΠϝʔδΛࢦఆ w EɿόοΫάϥϯυ࣮ߦ w ίϯςφऴྃ࣌ʹফ͑ͨΒࠔΔͷͰSNࢦఆ͠ͳ͍
ίϯςφͷଓ w ίϯςφͰ৽͘͠CBTIϓϩηεΛ࡞Γɺͦͷඪ४ೖྗΛܨ͙ • $ docker container exec -it sl_test
/bin/bash w ͜ΕͰTMίϚϯυ͕͖ͨͨ์ʂ w FYJUͯ͠ൈ͚·͠ΐ͏
ίϯςφίϚϯυͷ࣮ߦ w CBTI͕ͦͷ··ಈ͘Α͏ʹɺଞͷϓϩάϥϜಈ͘ w TMΛͦͷ··࣮ߦͯ͠ΈΑ͏ • $ docker container exec
-it sl_test sl w େ͚͛ͩ͞Ͳ ݩͷڥΛԚછͤͣʹ৭ʑೖΕͯ͑Δศར͞
ίϯςφͷআ w ͍Βͳ͘ͳͬͨίϯςφࢭΊ͔ͯΒআ w ಈ͍͍ͯΔίϯςφDPOUBJOFSαϒίϚϯυͷMTίϚϯυͰ֬ೝ w ఀࢭதؚΊͯ͢ͷίϯςφΛݟ͍ͨͳΒBΦϓγϣϯ • $ docker
container ls -a • $ docker ps -a w ίϯςφ*%·ͨίϯςφ໊Λࢦఆͯ͠আ • $ docker container stop CONTAINER_NAME • $ docker container rm CONTAINER_NAME
Πϝʔδͷআ w ͍Βͳ͍Πϝʔδ༰ྔΛ৯͏͚ͩͳͷͰআ w ΠϝʔδJNBHFαϒίϚϯυͰૢ࡞ w ΠϝʔδͷҰཡMTίϚϯυͰऔಘ • $ docker
image ls • $ docker images w SNίϚϯυͰআ • $ docker image rm IMAGE_NAME • $ docker rmi IMAGE_NAME
ԋशɿ3VCZίϯςφͷ࡞ w 3VCZΠϯλϓϦλ͕ಈ͘ίϯςφΛ࡞ͬͯΈΑ͏ w ެࣜͷSVCZΠϝʔδଘࡏ͠·͕͢ʜ w %PDLFSpMF*NBHF࡞ίϯςφੜίϚϯυ࣮ߦ w 3VCZΠϯλϓϦλͷىಈʮJSCʯίϚϯυͰ͢
ԋशɿ8FCίϯςφͷ࡞ w /HJOYͰ)5.-Λදࣔ͢ΔίϯςφΛ࡞ͬͯΈΑ͏ w OHJOYϕʔεΠϝʔδΛ͏ͱศརͰ͢ w VTSTIBSFOHJOYIUNMҎԼʹϑΝΠϧΛίϐʔ͠·͢ w ϑΝΠϧͷίϐʔʹ$01:໋ྩΛ͍·͢ w
ىಈҎԼͷίϚϯυͰɻϙʔτΛ࿐ग़ͤ͞ΔઃఆΛՃͯ͠·͢ • $ docker run -d --name nginx_test -p 80:80 <image_name>
લ͜͜·Ͱʂ
.VMUJ4UBHF#VJME
Ϗϧυ͕ඞཁͳίϯςφΛ࡞Δ w ͍··Ͱͷ%PDLFSίϯςφͷ࡞Γํ w 36/໋ྩΛׂ͢ΔͱϨΠϠ͕૿͑Δ w ϏϧυʹඞཁͳͷΛΠϯετʔϧͯ͠ w ιʔείʔυΛམͱ͖ͯͯ͠ w
Ϗϧυͯ͠ w Ϗϧυ࣌ͷґଘύοέʔδɾιʔείʔυΛফ͢ w ͜ΕΒΛׂ࣮ͯ͠ߦ͢Δͱ
೦ͳΠϝʔδ %PDLFS*NBHF Ϗϧυ ιʔεμϯϩʔυ ґଘΠϯετʔϧ ෆཁͷফڈ ͍Βͳ͍ͷ·Ͱ Πϝʔδʹؚ·ΕΔ
શମΛϨΠϠʹ·ͱΊΔ %PDLFS*NBHF ෆཁͷফڈ Ϗϧυ ιʔεμϯϩʔυ ґଘΠϯετʔϧ ͍Βͳ͍ͷ ؚ·Εͳ͍ ˠαΠζͷॖখ
ͰͬͺΓ w ໘ w ͦ͜Ͱɺ.VMUJ4UBHF#VJME
.VMUJ4UBHF#VJME #VJME*NBHF Ϗϧυ ιʔεμϯϩʔυ ґଘΠϯετʔϧ 3VOUJNF*NBHF ґଘΠϯετʔϧ ϏϧυՌ Ռ͚ͩίϐʔ͠ɺ ࣮ߦ༻ίϯςφͷΈΛ
4-Ͱ.VMUJ4UBHF#VJMEΛମݧ w 4-ΛϏϧυͯ͠ɺͦͷՌ͚ͩΛ࣮ߦ࣌ίϯςφʹࡌͤΔ w ࣮4-ͷ࣮ߦʹODVSTFT͕ඞཁ w ࣮ߦ࣌ίϯςφʹΠϯετʔϧ͓ͯ͘͠ w %PDLFSͰΑ͘͏ܰྔ-JOVYͷ"MQJOF-JOVYΛͬͯͬͯΈΑ͏
4-Ͱ.VMUJ4UBHF#VJMEΛମݧ FROM alpine AS build-sl RUN apk --no-cache add alpine-sdk
ncurses-dev && \ git clone https://github.com/mtoyoda/sl.git && \ cd sl && \ make FROM alpine RUN apk --no-cache add ncurses COPY --from=build-sl /sl/sl /usr/bin/sl "4ͰதؒΠϝʔδʹ໋໊ GSPNͰதؒΠϝʔδ͔ΒՌΛίϐʔ
Մมσʔλͱ ෳίϯςφͷ࿈ܞ
Մมσʔλͷߦํ w %PDLFSίϯςφ͍ࣺͯ w ՄมσʔλϨΠϠίϯςφʹؚ·ΕΔ w ΑͬͯՄมσʔλίϯςφ͕ࢮ͵ͱҰॹʹࢮ͵ w ඇৗʹࠔΔʢ࣮ࡍࠔͬͨʣ
%PDLFS7PMVNF w Մมσʔλ7PMVNFͱͯ͠ผͷͱ͜Ζʹஔ͖ɺͦΕΛϚϯτ w छྨͷํ๏ w طଘσΟϨΫτϦͷϚϯτ w WPMVNFίϚϯυʹΑΔੜ
طଘσΟϨΫτϦͷϚϯτ w ϗετʹσʔλอଘ༻σΟϨΫτϦΛ࡞ΓͦΕΛϚϯτ͢Δ w ύʔϛογϣϯ͕͍ؔ͜͠ͷͰɺ͋Μ·Γ͓͢͢Ί͠ͳ͍ w ίϯςφଆͰੜ͞ΕͨσʔλͷṖύʔϛογϣϯ w ॻ͖ࠐΉଆΛϗετ͔ήετʹݶఆ͢Ε0,
WPMVNFίϚϯυʹΑΔੜ w %PDLFSʹ͓ͯ͢·͔ͤ͢Δ w ྑ͍ײ͡ʹͬͯ͘ΕΔͷͰָ • $ docker volume create
--name hogehoge
3FENJOFίϯςφΛ࡞Δ w ϓϩδΣΫτཧπʔϧ3FENJOFͷίϯςφΛ࡞ͬͯΈΔ w ͱΓ͋͑ͣԼௐΛͯ͠ͲΜͳ෩ʹίϯςφΛ࡞Εྑ͍͔ݕ౼
ΕͬͭԼௐ w 3FENJOFίϯςφΛ࡞ΔͨΊʹԿ͕ඞཁ͔ΛԼௐ w ͱΓ͋͑ͣ%PDLFS)VCͰݕࡧͯ͠ΈΔ w IUUQTIVCEPDLFSDPNSMJCSBSZSFENJOF
ΕͬͭԼௐ w ҎԼͷ߲ʹ w 5BH w ґଘ͍ͯ͠Δίϯςφ w ͑Δڥม
w ෦Ͱ͏ϙʔτ w ӬଓσʔλͷϚϯτॴ
ΕͬͭԼௐ w 5BH w MBUFTUͰΑͦ͞͏ w ґଘ͍ͯ͠Δίϯςφ w ͳΜΒ͔ͷ%#͕ඞཁΒ͍͠ͱΓ͋͑ͣ.Z42-
w ͑Δڥม w %#ͷଓઌύεϫʔυ͕ࢦఆग़དྷΔΒ͍͠ w ෦Ͱ͏ϙʔτ w ൪ w ӬଓσʔλͷϚϯτॴ w lVTSTSDSFENJOFpMFTzʹఴϑΝΠϧ͕ஔ͔ΕΔΒ͍͠
ΕͬͭԼௐ w .Z42-ʹ͍ͭͯಉ༷ͷใΛऩू͢Δ
ΕͬͭԼௐ w 5BH w MBUFTUͰΑͦ͞͏ w ͑Δڥม w SPPUͷύεϫʔυॳظ%#໊͕ࢦఆग़དྷΔΒ͍͠
w ӬଓσʔλͷϚϯτॴ w lWBSMJCNZTRMzʹσʔλϕʔε͕ஔ͔ΕΔΒ͍͠
Լௐྃ w ͬ͟ͱ͜ͷ͙Β͍Լௐग़དྷͨΒίϚϯυΛΈཱͯΑ͏ʂ
3FENJOFίϯςφΛ࡞Δ w ίϚϯυͨͬͨͷߦʢߦ͕͍ͱݴͬͯͳ͍ʣ • $ docker volume create --name redmine_db
• $ docker volume create --name redmine_file • $ docker run -d --name rm-mysql \ -e MYSQL_ROOT_PASSWORD=password \ -e MYSQL_DATABASE=redmine -v redmine_db:/var/lib/mysql mysql • $ docker run -d -p 3000:3000 --name redmine \ --link rm-mysql:mysql \ -v redmine_file:/usr/src/redmine/files redmine
3FENJOFͷಈ࡞֬ೝ w IUUQMPDBMIPTU w QΦϓγϣϯͷࠨଆ͕ެ։ϙʔτͰӈଆ͕ίϯςφ෦ϙʔτ w ैͬͯ൪ϙʔτʹΞΫηε͢Ε0,
ΊΜͲ͘͘͞ͳ͍ʁ w ͍͘ΒԿͰίϚϯυ͕͗͢Δ w αʔϏε͝ͱʹίϯςφΛݐͯΔίϚϯυΛԆʑͱೖྗͨ͘͠ͳ͍
%PDLFS$PNQPTF w %PDLFSίϯςφͷ౷߹ཧπʔϧ w ZBNMܗࣜͷςΩετͰهड़ w ͬͺΓ(JUͰཧ͍͢͠ w ϑΝΠϧ໊zEPDLFSDPNQPTFZNMzͰݻఆ w
ͱΓ͋͑ͣ3FENJOFΛىಈͰ͖ΔϑΝΠϧΛݟͯΈΔ
3FENJOFͰͷྫ version: '3' services: mysql: image: mysql volumes: - data:/var/lib/mysql
environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: redmine redmine: image: redmine volumes: - files:/usr/src/redmine/files ports: - "3000:3000" environment: REDMINE_DB_MYSQL: mysql REDMINE_DB_PASSWORD: password depends_on: - mysql volumes: data: files:
֤ηΫγϣϯͷઆ໌ ηΫγϣϯ໊ આ໌ WFSTJPO EPDLFSDPNQPTFZNMͷॻࣜόʔδϣϯ Λ͍ͬͯΔͷͰ͋ΕΛهೖ TFSWJDFT ίϯςφͷఆٛ WPMVNFT ӬଓσʔλྖҬͷఆٛ
TFSWJDFTηΫγϣϯ ηΫγϣϯ໊ આ໌ JNBHF 1VMMͯ͘͠ΔΠϝʔδ໊ WPMVNFT Ϛϯτ͢ΔϘϦϡʔϜ QPSUT ϙʔτͷϚοϐϯά FOWJSPONFOU
ڥม EFQFOET@PO ґଘ͍ͯ͠Δίϯςφ໊ ෦%/4Ͱ໊લղܾΛ࣮ࢪ
࣮ߦͷ४උ w खಈͰ࡞ͬͨ3FENJOF.Z42-ίϯςφͷফڈ w 7PMVNFআ͓ͯ͘͠ • $ docker volume ls
• $ docker volume rm VOLUME_NAME
͍࣮͟ߦ • $ docker-compose up -d w EɿόοΫάϥϯυ࣮ߦ w ͯ͢ͷίϯςφΛࢭΊ͍ͨͱ͖
• $ docker-compose stop w ͯ͢ͷίϯςφΛఀࢭ͔ͯ͠Βআ͍ͨ͠ͱ͖ • $ docker-compose down
ΊͬͪΌָ w ෳίϯςφΛཧ͢ΔࡍʹEPDLFSDPNQPTF w ໊લΛॻ͍͓͚ͯͩ͘ͰWPMVNFࣗಈੜ
7PMVNFͷόοΫΞοϓ w όοΫΞοϓ༻ͷҰ࣌ίϯςφΛ࡞ΓϗετଆʹϑΝΠϧΛίϐʔ • $ mkdir bkup && cd bkup
• $ docker run --rm -v VOL_NAME:/volume \ -v $(realpath .):/bkp busybox \ tar cvf /bkp/FILENAME.tar /volume
ԋश w 8PSEQSFTTίϯςφΛEPDLFSDPNQPTFͰ࡞ͬͯΈΑ͏ w 8PSEQSFTTίϯςφͱ.Z42-ίϯςφͷΈ߹Θͤ w 8PSEQSFTTଆ͔Β.Z42-ଆΛೝࣝ͢ΔͨΊͷڥมʁ w ͲͷϙʔτΛόΠϯυ͢Δʁ
·ͱΊ w %PDLFSͷٕज़എܠ͕Θ͔ͬͨ w %PDLFSpMF͕࡞ΕΔΑ͏ʹͳͬͨ w ίϯςφ͕࡞ΕΔΑ͏ʹͳͬͨ w .VMUJ4UBHF#VJME͕Ͱ͖ΔΑ͏ʹͳͬͨ w
7PMVNFΛѻ͑ΔΑ͏ʹͳͬͨ w $PNQPTFͰෳίϯςφ͕ཧͰ͖ΔΑ͏ʹͳͬͨ