[CentOS] 7.9 Docker ์„ค์น˜

2022. 9. 13. 18:37ใ†System ์ž‘์—…์‹ค/LINUX

728x90
๋ฐ˜์‘ํ˜•

 

 

 




 

 

 

๐Ÿš€ CentOS 7.9 Docker Install

    ๐Ÿ”ฝ  yum

        ๐Ÿ“ฆ ์„ค์ •

์ตœ์ดˆ Yum Repository ์„ค์ •์„ ์ง„ํ–‰ํ•ด ์ค„๊ฒŒ์š”.

yum install -y yum-utils



 

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

 

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

    ๐Ÿ”ฝ  Docker CE

        ๐Ÿ“ฆ ์„ค์น˜

Docker CE๋ฅผ yum์„ ํ†ตํ•ด ์„ค์น˜ํ•˜๋„๋ก ํ• ๊ฒŒ์š”.

yum install docker-ce docker-ce-cli containerd.io

๋ฐ˜์‘ํ˜•

 

 

 



ํ˜„์žฌ ์„ค์น˜ ๊ฐ€๋Šฅํ•œ Docker Version์„ ํ™•์ธํ•ด ๋ณผ๊ฒŒ์š”.

docker --version


์ •์ƒ์ ์œผ๋กœ Docker๊ฐ€ ์„ค์น˜ ๋˜์—ˆ๋Š”์ง€ ์œ„์˜ ๋ช…๋ น์–ด๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.




728x90


CentOS๊ฐ€ Booting๋˜๋ฉด ์ž๋™์œผ๋กœ docker๊ฐ€ ๊ธฐ๋™๋˜๊ฒŒ ์„ค์ •ํ•ด ์ฃผ์—ˆ๊ณ , ๋ฐ”๋กœ docker Deamon์„ ์‹คํ–‰ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 

systemctl status docker

docker๊ฐ€ ์ •์ƒ ๊ธฐ๋™์ค‘์ธ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 


Docker ์‚ฌ์šฉ์ž๊ฐ€ root๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด ๋ช…๋ น์–ด๋ฅผ ์“ธ ๋•Œ ๋งˆ๋‹ค sudo๋ผ๋Š” ๋ช…๋ น์–ด๋ฅผ ์ ‘๋‘์‚ฌ์— ๋ถ™์—ฌ์ค˜์•ผ ํ•˜๋Š” ๊ฒƒ์ด์—์š”.
ํ•˜์ง€๋งŒ, ์œ„์™€ ๊ฐ™์ด ํŠน์ • ์‚ฌ์šฉ์ž๋ฅผ docker๋ผ๋Š” ๊ทธ๋ฃน์— ๋„ฃ์–ด์ฃผ๋ฉด sudo ๋ช…๋ น์–ด ์—†์ด๋„ docker ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

    ๐Ÿ”ฝ  Docker Compose

        ๐Ÿ“ฆ ์„ค์น˜

Docker Compose 2.12.2 Version ๋‚ด๋ ค๋ฐ›๊ธฐ


์œ„์™€ ๊ฐ™์ด Docker Compose ์„ค์ • ๊ด€๋ จ ๋‚ด์šฉ์„ ์ €์žฅํ•  Directory๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ๊ณ , github์—์„œ ๋‚ด๋ ค๋ฐ›๊ธฐ๋ฅผ ์ง„ํ–‰ํ•ด ์ฃผ์—ˆ์–ด์š”.

์œ„ ๋ช…๋ น์–ด๋Š” Compose CLI Plugin์„ ๋‚ด๋ ค ๋ฐ›์€ ๊ฒƒ์ด์—์š”.

๋˜ํ•œ, Docker Compose๋ฅผ ๋‚ด๋ ค๋ฐ›๊ณ , $Home Directory ์•„๋ž˜์— ์‚ฌ์šฉ์ž์šฉ Compose๋ฅผ ์„ค์น˜ํ•ด ์ค„๊ฒƒ์ด์—์š”.


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


sudo ๋ช…๋ น์–ด ์‚ฌ์šฉ์— ๋Œ€ํ•œ ๊ฒฝ๊ณ ๋ฌธ์ด ๊ต‰์žฅํžˆ ์ธ์ƒ์ ์ด์—์š”.

๋จผ์ € ๋ฐ”์ด๋„ˆ๋ฆฌ์— ๋Œ€ํ•œ ์‹คํ–‰ ๊ถŒํ•œ์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์œ„์˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด ์ฃผ์—ˆ์–ด์š”.



์œ„์™€ ๊ฐ™์ด ์„ค์ •ํ•˜๊ฒŒ ๋˜๋ฉด ํŠน์ • ์‚ฌ์šฉ์ž ๊ณ„์ •์—์„œ๋งŒ Docker Compose๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์„๊ฒƒ์ด์—์š”.

์ด ๋ถ€๋ถ„์„ ์ „์—ญ์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด ์„ค์ •ํ•ด ์ค„๊ฒŒ์š”.

 


์ตœ์ดˆ /usr Directory ๋ฐ‘์— docker Directory๋ฅผ ๋งŒ๋“ค์–ด์ฃผ๊ณ , cli-plugins๋ฅผ ๋ณต์‚ฌํ•ด ์ฃผ์—ˆ์–ด์š”.


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


์œ„์™€ ๊ฐ™์ด ์‹คํ–‰ ๊ถŒํ•œ์„ ์ฃผ์—ˆ์–ด์š”.

docker compose version


Docker Compose๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•