โš™๏ธ Devops/๐Ÿณ Docker

Docker, Docker-Compose ์„ค์น˜ํ•˜๊ธฐ - Ubuntu 20.04 LTS

iseunghan 2022. 5. 17. 11:56
๋ฐ˜์‘ํ˜•

Docker ์„ค์น˜

์‹คํ–‰ํ™˜๊ฒฝ: Ubuntu 20.04 LTS

์—…๋ฐ์ดํŠธ ๋ฐ HTTP ํŒจํ‚ค์ง€ ์„ค์น˜

$ sudo apt update
$ sudo apt-get install -y ca-certificates \ 
    curl \
    software-properties-common \
    apt-transport-https \
    gnupg \
    lsb-release

GPG ํ‚ค ๋ฐ ์ €์žฅ์†Œ ์ถ”๊ฐ€

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Repository ๋“ฑ๋ก

 echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

์ตœ์‹  ๋ฒ„์ „ ์„ค์น˜

$ sudo apt update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

ํŠน์ • ๋ฒ„์ „ ์„ค์น˜

$ sudo apt-get install docker-ce=5:20.10.14~3-0~ubuntu-focal docker-ce-cli=5:20.10.14~3-0~ubuntu-focal containerd.io

Docker ์‹คํ–‰๊ถŒํ•œ ๋ถ€์—ฌ

$ sudo usermod -aG docker $USER

๋„์ปค ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ๋งค๋ฒˆ sudo ๊ถŒํ•œ์„ ์š”์ฒญํ•˜์ง€ ์•Š๊ธฐ ์œ„ํ•ด ํ˜„์žฌ ์œ ์ €๋ช…์„ ๋„์ปค ๊ทธ๋ฃน์— ์ถ”๊ฐ€ํ•ด์ค๋‹ˆ๋‹ค.

Docker ์„ค์น˜ ํ™•์ธ

$ docker --version

Docker Compose ์„ค์น˜

compose ์„ค์น˜

์›ํ•˜๋Š” version์„ ์„ค์น˜ํ•˜๊ณ  ์‹ถ์œผ๋ฉด, v2.5.0 ๋Œ€์‹  ๋ฒ„์ „ ๋ช…์‹œ

$ sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

์‹คํ–‰๊ถŒํ•œ ๋ถ€์—ฌ

$ sudo chmod +x /usr/local/bin/docker-compose

Docker-compose ์„ค์น˜ ํ™•์ธ

$ docker-compose --version
๋ฐ˜์‘ํ˜•