Prerequisites
OS requirements
Ubuntu Jammy 22.04 (LTS)
Ubuntu Impish 21.10
Ubuntu Focal 20.04 (LTS)
Ubuntu Bionic 18.04 (LTS)
Shell
볡μ¬
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.
Shell
볡μ¬
2.
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
Shell
볡μ¬
3.
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
Shell
볡μ¬
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
Shell
볡μ¬
docker μ€μΉ μ΄νμ root κΆνμ΄ μλ μΌλ° μ¬μ©μ κΆν(docker)μΌλ‘ κ΄λ¦¬νκΈ° μν μμ
μ μ§νν©λλ€.
$ cat /etc/group | grep docker
docker:x:999:
Shell
볡μ¬
λ§μ½ μ€μΉ μ΄νμ group νμΌμ docker μ λ³΄κ° μλ€λ©΄ μ€μΉ κ³Όμ μμ μλ¬κ° λ°μνμ§ μμλμ§ νμΈν©λλ€. λλ docker λͺ
λ Ήμ΄ μνμ΄ μ μμ μΈμ§ νμΈμ μ§νν©λλ€.
νμ¬ μ¬μ©μλ docker λͺ
λ Ήμ΄λ₯Ό μ¬μ©ν μ μκ² group λ΄μ©μ μμ ν©λλ€.
$ sudo usermod -aG docker $USER
$ cat /etc/group | grep docker
docker:x:999:ubuntu
Shell
볡μ¬
μ΄νμ κΆνμ΄ μ μ©λλμ§ νμΈν©λλ€.
$ sudo docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
compose: Docker Compose (Docker Inc., v2.10.2)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info": dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info
Shell
볡μ¬
docker groupμ ν¬ν¨μμΌ κΆνμ ν λΉνμ§λ§ μ€μ μ μ©μ μ¬μ μμ ν΄μΌ μ μ©μ΄ λ©λλ€.
$ docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
compose: Docker Compose (Docker Inc., v2.10.2)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.18
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
...
Shell
볡μ¬