목차
docker 공식 블로그를 내가 보기 쉽게 번역해놓은거임
여러 설치 방법중 apt repo 를 이용한 설치만 포스팅함
https://docs.docker.com/engine/install/ubuntu/
Install using the apt repository
1. 설치 준비
1.1 apt 업데이트 + 필요 패키지 다운로드
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
1.2 docker 공식 GPG key 추가
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
1.3 아래 명령을 통해 리포지토리 설정
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
2. docker engine 설치
2.1 apt 업데이트
위에서 추가해준 설정 반영
sudo apt-get update
2.2 docker engine, containerd, docker compose 설치 (최신버전)
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2.3 docker engine, containerd, docker compose 설치 (특정버전)
# List the available versions:
apt-cache madison docker-ce | awk '{ print $3 }'
5:24.0.0-1~ubuntu.22.04~jammy
5:23.0.6-1~ubuntu.22.04~jammy
<...>
환경변수에 버전 정보 저장 후 사용
VERSION_STRING=5:24.0.0-1~ubuntu.22.04~jammy
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
2.4 확인
$ sudo docker version
[sudo] password for cyaninn:
Client: Docker Engine - Community
Version: 24.0.2
API version: 1.43
Go version: go1.20.4
Git commit: cb74dfc
Built: Thu May 25 21:51:00 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.2
API version: 1.43 (minimum version 1.12)
Go version: go1.20.4
Git commit: 659604f
Built: Thu May 25 21:51:00 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.21
GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
Version: 1.1.7
GitCommit: v1.1.7-0-g860f061
docker-init:
Version: 0.19.0
GitCommit: de40ad0
sudo 없이 docker 명령 실행
https://blusky10.tistory.com/359
$ sudo usermod -aG docker [현재사용자]
#현재 사용자 확인
whoami
#재부팅 후 적용된다고 함
확인
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
uninstall docker engine
패키지 제거
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
이미지, 컨테이너, 볼륨 혹은 커스텀 설정 파일은 자동적으로 삭제되지 않는다고 함.
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd