[Docker]Ubuntu22.04.05 LTS Server Docker, Docker-compose ์„ค์น˜

2023. 6. 16. 12:17ใ†System ์ž‘์—…์‹ค/Docker

728x90
๋ฐ˜์‘ํ˜•

 

 



 

 

๐Ÿš€ Ubuntu 22.04.05 LTS

    ๐Ÿ”ฝ Container ๊ฐ€์ƒํ™”

        ๐Ÿ“ฆ ์„ค์น˜

์ตœ์ดˆ Docker ๊ด€๋ จ Package ์กด์žฌ ์—ฌ๋ถ€ ํ™•์ธ์„ ์œ„ํ•ด Package ๋ชฉ๋ก์„ ์กฐํšŒํ•ด ๋ณผ๊ฒŒ์š”.
์ด๋ฒˆ ์‹œ๊ฐ„์— ์„ค์น˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒƒ์€ docker.io์™€ docker-compose์—์š”.


apt list docker.io docker-compose

 


๋จผ์ € Docker๋ฅผ ์„ค์น˜ํ•ด ๋ณด๋„๋ก ํ• ๊ฒŒ์š”.

apt-get install docker.io -y

728x90


์œ„ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด docker.io๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์–ด์š”.


docker --version

 


์œ„์™€ ๊ฐ™์ด Docker๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜ ๋˜์—ˆ์–ด์š”.


systemctl enable docker

 


์œ„์˜ ๋ช…๋ น์–ด๋กœ ์„œ๋ฒ„๊ฐ€ ์žฌ๊ธฐ๋™ ๋˜๊ฑฐ๋‚˜ ํ•˜๋”๋ผ๋„ Docker Deamon์ด ์ž๋™์œผ๋กœ ์˜ฌ๋ผ์˜ฌ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ค„ ์ˆ˜ ์žˆ์–ด์š”.

systemctl start docker

 


์œ„์™€ ๊ฐ™์ด Docker Deamon์ด ์ž˜ ์˜ฌ๋ผ๊ฐ„ ๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

        ๐Ÿ“ฆDocker-compose ์„ค์น˜

Docker-compose๋ฅผ ์ด์šฉํ•˜๋ฉด Docker๋ฅผ ๋งŒ๋“ค ๋•Œ,yaml ํ™•์žฅ์ž File์„ ์ด์šฉํ•˜์—ฌ
์—ฌ๋Ÿฌ Docker Container๋ฅผ ํ•œ๋ฒˆ์— ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด ์ฃผ๋Š” ์นœ๊ตฌ์—์š”.

Docker Compose Git Hub ๊ณต์‹ Repository
์—์„œ ์ตœ์‹  Version์„ ํ™•์ธํ•˜๊ณ , ๋‚ด๋ ค ๋ฐ›์„ ์ˆ˜ ์žˆ์–ด์š”.


์ฐธ๊ณ ๋กœ ํ•ด๋‹น ์ž‘์—…์€ root๊ฐ€ ์•„๋‹Œ ๋‹ค๋ฅธ ๊ณ„์ •์œผ๋กœ ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

 

DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
๋ฐ˜์‘ํ˜•
 


์ตœ์ดˆ Docker Compose CLI๋ฅผ ๋‚ด๋ ค ๋ฐ›๊ธฐ ์œ„ํ•ด Directory๋ฅผ ๋งŒ๋“ค๊ณ , ์ƒ์„ฑํ•ด ์ฃผ์—ˆ๊ณ ,
curl์„ ์ด์šฉํ•ด์„œ ๋‚ด๋ ค๋ฐ›๊ธฐ ํ•˜์—ฌ ์ฃผ์—ˆ์–ด์š”.


์ด ๋ช…๋ น์€ ์ตœ์‹  Docker Compose (Compose Releases Repository)์˜ ์ตœ์‹  ๋ฆด๋ฆฌ์Šค๋ฅผ ๋‚ด๋ ค ๋ฐ›๊ณ ,
$home Directory ์•„๋ž˜์—์„œ ํ™œ์„ฑ ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•ด Compose๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด์—์š”.

Docker๋Š” ์‹œ์Šคํ…œ์˜ ๋ชจ๋“  ์‚ฌ์šฉ์ž๊ฐ€ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด
~/.docker/cli-plugins๋ฅผ/usr/local/lib/docker/cli-plugins
๋กœ cp๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๋ณต์‚ฌํ•˜์—ฌ ์˜ฎ๊ฒจ์ค„ ๊ฑฐ์—์š”.

chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

 


์œ„์—์„œ ๋‚ด๋ ค ๋ฐ›๊ธฐ ์œ„ํ•˜์—ฌ ๋งŒ๋“  Directory์— ๋ชจ๋“  ์‚ฌ์šฉ์ž๊ฐ€ ์‹คํ–‰ ๊ถŒํ•œ์„ ๊ฐ–์„ ์ˆ˜ ์žˆ๋„๋ก ํ•ด ์ฃผ์—ˆ์–ด์š”.


mkdir -p /usr/local/lib/docker

 


Docker Compose๋ช…๋ น์–ด๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ์œ„์˜ Direcory๋ฅผ ์ฝ๊ฒŒ ๋˜์–ด ์žˆ์–ด์š”.
๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ์œ„์™€ ๊ฐ™์ด Directory๋ฅผ ์ƒ์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.

cp -r $DOCKER_CONFIG/cli-plugins /usr/local/lib/docker

 


์œ„์—์„œ ๋‚ด๋ ค ๋ฐ›์•˜๋˜ cli-plugins Binary File์„ ๋ณต์‚ฌํ•˜์—ฌ ๋ถ™ํ˜€๋„ฃ์–ด ์ฃผ์—ˆ์–ด์š”.

chmod +x /usr/local/lib/docker/cli-plugins/docker-compose

 


๊ทธ๋Ÿฐ ๋’ค ๋ถ™ํ˜€๋„ฃ์–ด ์คฌ๋˜ Directory ์—ญ์‹œ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๋“ค๋„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ์‹คํ–‰ ๊ถŒํ•œ์„ ์ฃผ์—ˆ์–ด์š”.

์œ„์™€ ๊ฐ™์ด Docker compose Version์ด ์ถœ๋ ฅ๋˜๋ฉด ์ •์ƒ ์„ค์น˜ ๋œ ๊ฒƒ์ด์—์š”.

 

 

 

 





๐Ÿง ์ฐธ๊ณ  ์ž๋ฃŒ

 

[CentOS] 7.9 Docker ์„ค์น˜

๐Ÿš€ CentOS 7.9 Docker Install ๐Ÿ”ฝ yum ๐Ÿ“ฆ ์„ค์ • ์ตœ์ดˆ Yum Repository ์„ค์ •์„ ์ง„ํ–‰ํ•ด ์ค„๊ฒŒ์š”. "์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค." ๐Ÿ”ฝ Docker CE ๐Ÿ“ฆ ์„ค์น˜ D

junyharang.tistory.com

 

 

 

Install the Compose plugin

 

docs.docker.com

 

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•