[Setting | Ubuntu] Docker 설치

우분투 환경에 Docker 설치 방법을 정리한다.
docker docs


작성일 : 2022-06-08
OS : Ubuntu 22.04 LTS
Docker : 20.10.17

1> Uninstall old version

sudo apt-get remove docker docker-engine docker.io containerd runc

2> Set up the repository

# package index update
sudo apt-get update
# install require package
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
# add GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# set up repository
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

3> Install Docker

최신 버전 (20.10.17) 설치

sudo apt-get update

# 설정된 저장소에서 설치가능한 목록확인
sudo apt-cache madison docker-ce
------------------------------------------------------------------------
 docker-ce | 5:20.10.17~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
 docker-ce | 5:20.10.16~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
 docker-ce | 5:20.10.15~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
 docker-ce | 5:20.10.14~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
 docker-ce | 5:20.10.13~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
root@opendocs:/etc/apt/keyrings# sudo apt-get update
--------------------------------------------------------------------------

# 특정 버전으로 설치
sudo apt-get install docker-ce=5:20.10.17~3-0~ubuntu-jammy docker-ce-cli=5:20.10.17~3-0~ubuntu-jammy containerd.io docker-compose-plugin