[Docker] tl;dr docker, docker-compose 설치하기

2024. 4. 6. 17:35BE/Docker

728x90
sudo apt-get update

# 디펜던시 추가
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

# public key 등록
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

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-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

# docker-compose 설치
sudo curl -sSL "https://github.com/docker/compose/releases/download/v2.15.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# docker permission
sudo usermod -aG docker $USER

# docker-compose permission
sudo chmod +x /usr/local/bin/docker-compose
sudo chmod 666 /var/run/docker.sock