Prerequisites

OS requirements

Ubuntu Jammy 22.04 (LTS)
Ubuntu Impish 21.10
Ubuntu Focal 20.04 (LTS)
Ubuntu Bionic 18.04 (LTS)

Set up the repository

  1. HTTPS를 통해서 Repository를 사용할 수 있게 설정하고 패키지 인덱스를 업데이트 및 설치합니다.
$ sudo apt-get update
Hit:1 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy InRelease
Get:2 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates InRelease [114 kB]
Get:3 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports InRelease [99.8 kB]
Get:4 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy/universe amd64 Packages [14.1 MB]
Get:5 <http://security.ubuntu.com/ubuntu> jammy-security InRelease [110 kB]
Get:6 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy/universe Translation-en [5652 kB]
Get:7 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy/universe amd64 c-n-f Metadata [286 kB]
Get:8 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy/multiverse amd64 Packages [217 kB]
Get:9 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy/multiverse Translation-en [112 kB]
Get:10 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy/multiverse amd64 c-n-f Metadata [8372 B]
Get:11 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/main amd64 Packages [598 kB]
Get:12 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/main Translation-en [141 kB]
Get:13 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/main amd64 c-n-f Metadata [8632 B]
Get:14 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/restricted amd64 Packages [330 kB]
Get:15 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/restricted Translation-en [51.3 kB]
Get:16 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/universe amd64 Packages [422 kB]
Get:17 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/universe Translation-en [106 kB]
Get:18 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/universe amd64 c-n-f Metadata [4404 B]
Get:19 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/multiverse amd64 Packages [7220 B]
Get:20 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/multiverse Translation-en [2360 B]
Get:21 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates/multiverse amd64 c-n-f Metadata [420 B]
Get:22 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/main amd64 Packages [3008 B]
Get:23 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/main Translation-en [1432 B]
Get:24 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/main amd64 c-n-f Metadata [272 B]
Get:25 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/restricted amd64 c-n-f Metadata [116 B]
Get:26 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/universe amd64 Packages [6752 B]
Get:27 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/universe Translation-en [9240 B]
Get:28 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/universe amd64 c-n-f Metadata [352 B]
Get:29 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports/multiverse amd64 c-n-f Metadata [116 B]
Get:30 <http://security.ubuntu.com/ubuntu> jammy-security/main amd64 Packages [339 kB]
Get:31 <http://security.ubuntu.com/ubuntu> jammy-security/main Translation-en [78.4 kB]
Get:32 <http://security.ubuntu.com/ubuntu> jammy-security/restricted amd64 Packages [298 kB]
Get:33 <http://security.ubuntu.com/ubuntu> jammy-security/restricted Translation-en [46.3 kB]
Get:34 <http://security.ubuntu.com/ubuntu> jammy-security/universe amd64 Packages [282 kB]
Get:35 <http://security.ubuntu.com/ubuntu> jammy-security/universe Translation-en [61.4 kB]
Get:36 <http://security.ubuntu.com/ubuntu> jammy-security/universe amd64 c-n-f Metadata [2408 B]
Get:37 <http://security.ubuntu.com/ubuntu> jammy-security/multiverse amd64 Packages [4192 B]
Get:38 <http://security.ubuntu.com/ubuntu> jammy-security/multiverse Translation-en [900 B]
Get:39 <http://security.ubuntu.com/ubuntu> jammy-security/multiverse amd64 c-n-f Metadata [228 B]
Fetched 23.5 MB in 3s (6781 kB/s)
Reading package lists... Done

$ sudo apt-get install ca-certificates curl gnupg lsb-release
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20211016).
lsb-release is already the newest version (11.1.0ubuntu4).
curl is already the newest version (7.81.0-1ubuntu1.4).
gnupg is already the newest version (2.2.27-3ubuntu2.1).
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
  1. Docker official 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
  1. 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

Install Docker Engine

다시 한번 패키지 업데이트 수행 및 도커 엔진 설치를 진행합니다.

$ sudo apt-get update
Hit:1 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy InRelease
Hit:2 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-updates InRelease
Hit:3 <http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu> jammy-backports InRelease
Get:4 <https://download.docker.com/linux/ubuntu> jammy InRelease [48.9 kB]
Get:5 <https://download.docker.com/linux/ubuntu> jammy/stable amd64 Packages [7065 B]
Hit:6 <http://security.ubuntu.com/ubuntu> jammy-security InRelease
Fetched 55.9 kB in 1s (100 kB/s)
Reading package lists... Done

$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  docker-ce-rootless-extras docker-scan-plugin libltdl7 libslirp0 pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin docker-scan-plugin libltdl7 libslirp0 pigz slirp4netns
0 upgraded, 10 newly installed, 0 to remove and 40 not upgraded.
Need to get 109 MB of archives.
After this operation, 423 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

docker 설치 이후에 root 권한이 아닌 일반 사용자 권한(docker)으로 관리하기 위한 작업을 진행합니다.