Docker를 설치하는 3가지 방법.
- Docker repository 설정하고 apt를 이용하여 설치
- 인터넷이 안될 경우 .deb 패키지 파일을 다운로드하여 dpkg 명령어로 설치
- Docker 사이트에서 제공하는 설치용 스크립트(sh)파일을 받아 설치.
1. Docker Repository 설정하고 apt로 설치
1-1. 이전 버전 삭제
sudo apt-get remove docker docker-engine docker.io containerd runc
1-2. apt update & apt upgrade
$ sudo apt update & apt upgrade
1-3. 필수 패키지 다운로드
$ sudo apt-get install ca-certificates curl gnupg lsb-release
1-4. Docker공식 GPG Key 등록
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
1-5. Docker stable repository 등록
$ echo "deb [arch=$(dpkg --print-architecture) 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
1-6. Docker Engine 설치
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
1-6-1. 특정 버전의 Docker Engine 설치
$ sudo apt-cache madison docker-ce docker-ce-cli
설치를 원하는 버전을 고르고
sudo apt-get install docker-ce=<설치할버전> docker-ce-cli=<설치할버전> containerd.io
1-7. Docker가 설치 되었는지 확인
$ systemctl status docker
혹은
$ sudo docker --version
Docker version 20.10.14, build a224086
2. .deb 패키지 파일을 다운로드하여 dpkg 명령어로 설치
2-1. 사용하고 있는 우분투 버전별 명칭 확인하기.
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
2-2. 알맞은 버전의 .deb 다운로드
https://download.docker.com/linux/ubuntu/dists
링크 접속하여, 코드명 -> pool -> stable -> arch로 이동하여 설치하고 싶은 .deb을 고른다.
예를 들어, 아래 그림에서 노란색 표시된 부분을 다운로드 하고 싶다고 한다면,curl -O <인터넷주소>
명령어를 사용하여 다운로드 한다.
$ curl -O https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/containerd.io_1.5.11-1_amd64.deb
$ curl -O https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce-cli_20.10.9~3-0~ubuntu-focal_amd64.deb
$ curl -O https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce-rootless-extras_20.10.9~3-0~ubuntu-focal_amd64.deb
$ curl -O https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce_19.03.15~3-0~ubuntu-focal_amd64.deb
다운로드가 완료되었다면, 폴더 내에 있는 deb 파일을 모두 설치한다.
$ sudo dpkg -i *.deb
3. 설치용 스크립트(sh)파일로 설치하기
추가예정.
'Linux > Ubuntu' 카테고리의 다른 글
[Ubuntu] ssh로 서버 접속하기. (0) | 2022.04.12 |
---|---|
[Ubuntu] tar 명령어로 압축/압축해제하기 (0) | 2022.03.29 |
[Ubuntu] sftp 계정 만들기. (ssh는 접속 불가) (0) | 2021.12.08 |
[Ubuntu] apt update Error_1 (0) | 2021.09.28 |
[SSH] ssh나 telnet 접속시 메시지 띄우기 (1) | 2021.08.03 |
댓글