[root@localhost system]# sudo dnf config-manager --add-repo=https://download.docker.com/linux/fedora/docker-ce.repo
Adding repo from: https://download.docker.com/linux/fedora/docker-ce.repo
[root@localhost system]# sudo dnf install docker-ce
Docker CE Stable - x86_64 9.1 kB/s | 5.9 kB 00:00
Fedora Modular 31 - x86_64 4.8 kB/s | 6.3 kB 00:01
Fedora Modular 31 - x86_64 - Updates 6.8 kB/s | 6.7 kB 00:00
Fedora Modular 31 - x86_64 - Updates 123 kB/s | 192 kB 00:01
Fedora 31 - x86_64 - Updates 9.5 kB/s | 7.6 kB 00:00
Fedora 31 - x86_64 - Updates 279 kB/s | 401 kB 00:01
Fedora 31 - x86_64 2.9 kB/s | 6.4 kB 00:02
google-chrome 11 kB/s | 1.3 kB 00:00
Dependencies resolved.
======================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================
Installing:
docker-ce x86_64 3:19.03.4-3.fc31 docker-ce-stable 23 M
Installing dependencies:
containerd.io x86_64 1.2.10-3.2.fc31 docker-ce-stable 23 M
replacing runc.x86_64 2:1.0.0-101.rc9.gitc1485a1.fc31
docker-ce-cli x86_64 1:19.03.4-3.fc31 docker-ce-stable 39 M
libcgroup x86_64 0.41-22.fc31 fedora 65 k
Transaction Summary
======================================================================================================================
Install 4 Packages
Total download size: 85 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): docker-ce-cli-19.03.4-3.fc31.x86_64.rpm 5.8 MB/s | 39 MB 00:06
(2/4): docker-ce-19.03.4-3.fc31.x86_64.rpm 3.5 MB/s | 23 MB 00:06
(3/4): libcgroup-0.41-22.fc31.x86_64.rpm 211 kB/s | 65 kB 00:00
(4/4): containerd.io-1.2.10-3.2.fc31.x86_64.rpm 792 kB/s | 23 MB 00:29
----------------------------------------------------------------------------------------------------------------------
Total 2.8 MB/s | 85 MB 00:30
warning: /var/cache/dnf/docker-ce-stable-abb13ee9a85fa8f6/packages/containerd.io-1.2.10-3.2.fc31.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64 3.5 kB/s | 1.6 kB 00:00
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <[email protected]>"
Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
From : https://download.docker.com/linux/fedora/gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: libcgroup-0.41-22.fc31.x86_64 1/5
Installing : libcgroup-0.41-22.fc31.x86_64 1/5
Installing : docker-ce-cli-1:19.03.4-3.fc31.x86_64 2/5
Running scriptlet: docker-ce-cli-1:19.03.4-3.fc31.x86_64 2/5
Installing : containerd.io-1.2.10-3.2.fc31.x86_64 3/5
Running scriptlet: containerd.io-1.2.10-3.2.fc31.x86_64 3/5
Installing : docker-ce-3:19.03.4-3.fc31.x86_64 4/5
Running scriptlet: docker-ce-3:19.03.4-3.fc31.x86_64 4/5
Obsoleting : runc-2:1.0.0-101.rc9.gitc1485a1.fc31.x86_64 5/5
Running scriptlet: runc-2:1.0.0-101.rc9.gitc1485a1.fc31.x86_64 5/5
Verifying : containerd.io-1.2.10-3.2.fc31.x86_64 1/5
Verifying : runc-2:1.0.0-101.rc9.gitc1485a1.fc31.x86_64 2/5
Verifying : docker-ce-3:19.03.4-3.fc31.x86_64 3/5
Verifying : docker-ce-cli-1:19.03.4-3.fc31.x86_64 4/5
Verifying : libcgroup-0.41-22.fc31.x86_64 5/5
Installed:
docker-ce-3:19.03.4-3.fc31.x86_64 containerd.io-1.2.10-3.2.fc31.x86_64 docker-ce-cli-1:19.03.4-3.fc31.x86_64
libcgroup-0.41-22.fc31.x86_64
Complete!
[root@localhost system]# sudo systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@localhost system]# systemctl enable --now docker
[root@localhost system]# sudo usermod -aG docker yeqiang
[root@localhost system]#
[root@localhost system]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost system]#
[yeqiang@localhost ~]$ sudo chmod 666 /var/run/docker.sock
[sudo] password for yeqiang:
[yeqiang@localhost ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
参考文档:https://linuxconfig.org/how-to-install-docker-on-fedora-31