본문 바로가기

리눅스

[draft] 우분투에서 최신 버전의 Docker를 설치하는 방법

728x90

우분투에서 최신 버전의 Docker를 설치하는 방법(install docker on ubuntu)

테스트 환경

$ lsb_release -d
Description:    Ubuntu 22.04.1 LTS

이전 버전의 Docker 제거

  • 이미 이전 버전의 Docker가 설치되어 있다면 제거하는 것이 좋습니다.
sudo apt-get remove docker docker-engine docker.io containerd runc

패키지 목록 업데이트

sudo apt-get update

필수 패키지 설치

sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

도커 리포지토리 GPG key 추가

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

도커 리포지토리 추가

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
$ cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable

패키지 목록 업데이트

sudo apt-get update

도커 리포지토리에서 docker-ce 패키지 확인

sudo apt-cache policy docker-ce
docker-ce:
  Installed: (none)
  Candidate: 5:20.10.21~3-0~ubuntu-jammy
  Version table:
     5:20.10.21~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
     5:20.10.20~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
     5:20.10.19~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
...

Docker(docker-ce) 설치

sudo apt install -y docker-ce
$ sudo apt-cache policy docker-ce
docker-ce:
  Installed: 5:20.10.21~3-0~ubuntu-jammy
  Candidate: 5:20.10.21~3-0~ubuntu-jammy
  Version table:
 *** 5:20.10.21~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
        100 /var/lib/dpkg/status
     5:20.10.20~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
     5:20.10.19~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
...
728x90

docker 버전 정보

docker version
$ docker version
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:01:58 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 17:59:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.12
  GitCommit:        a05d175400b1145e5e6a735a6710579d181e7fb0
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

도커 데몬(서비스) 확인

sudo systemctl status docker

도커 데몬(서비스) 재기동

sudo systemctl restart docker
sudo systemctl enable docker

docker 그룹에 유저 추가

usermod -aG docker ${USER}
chmod 666 /var/run/docker.sock

Docker 동작 확인

  • Docker가 제대로 설치되었는지 확인하기 위해 hello-world 이미지를 실행해보세요.
sudo docker run hello-world

실행 결과에서 "Hello from Docker!" 메시지를 확인할 수 있어야 합니다.

docker-compose 설치

apt install -y docker-compose

docker-compose 버전 정보

$ docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.4
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022

ctop 설치

echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list
wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install -y docker-ctop
ctop -v
$ ctop -v
ctop version 0.7.7, build 11a1cb1 go1.18

 

참고URL

- Docker Documentation : Ubuntu에 Docker 엔진 설치

 

728x90