centos 8.4 安装 docker

内容纲要

环境

lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.4.2105
Release:    8.4.2105
Codename:   n/a

安装

先把老版本卸载

sudo yum remove docker \
>                 docker-client \
>                 docker-client-latest \
>                 docker-common \
>                 docker-latest \
>                 docker-latest-logrotate \
>                 docker-logrotate \
>                 docker-engine
No match for argument: docker
No match for argument: docker-client
No match for argument: docker-client-latest
No match for argument: docker-common
No match for argument: docker-latest
No match for argument: docker-latest-logrotate
No match for argument: docker-logrotate
No match for argument: docker-engine
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!

安装必要的依赖

sudo yum install -y yum-utils
Last metadata expiration check: 0:18:25 ago on Tue 30 Apr 2024 03:33:30 PM CST.
Package yum-utils-4.0.21-3.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

添加 Docker CE 仓库

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

安装 docker CE 版本

sudo yum install docker-ce docker-ce-cli containerd.io
Docker CE Stable - x86_64                                                                                                                            39 kB/s |  63 kB     00:01    
Dependencies resolved.
====================================================================================================================================================================================
 Package                                       Architecture               Version                                                        Repository                            Size
====================================================================================================================================================================================
Installing:
 containerd.io                                 x86_64                     1.6.31-3.1.el8                                                 docker-ce-stable                      35 M
 docker-ce                                     x86_64                     3:26.1.0-1.el8                                                 docker-ce-stable                      27 M
 docker-ce-cli                                 x86_64                     1:26.1.0-1.el8                                                 docker-ce-stable                     7.8 M
Installing dependencies:
 container-selinux                             noarch                     2:2.167.0-1.module_el8.5.0+911+f19012f9                        appstream                             54 k
 fuse-common                                   x86_64                     3.2.1-12.el8                                                   baseos                                21 k
 fuse-overlayfs                                x86_64                     1.7.1-1.module_el8.5.0+890+6b136101                            appstream                             73 k
 fuse3                                         x86_64                     3.2.1-12.el8                                                   baseos                                50 k
 fuse3-libs                                    x86_64                     3.2.1-12.el8                                                   baseos                                94 k
 libcgroup                                     x86_64                     0.41-19.el8                                                    baseos                                70 k
 libslirp                                      x86_64                     4.4.0-1.module_el8.5.0+890+6b136101                            appstream                             70 k
 slirp4netns                                   x86_64                     1.1.8-1.module_el8.5.0+890+6b136101                            appstream                             51 k
Installing weak dependencies:
 docker-buildx-plugin                          x86_64                     0.14.0-1.el8                                                   docker-ce-stable                      14 M
 docker-ce-rootless-extras                     x86_64                     26.1.0-1.el8                                                   docker-ce-stable                     5.0 M
 docker-compose-plugin                         x86_64                     2.26.1-1.el8                                                   docker-ce-stable                      13 M
Enabling module streams:
 container-tools                                                          rhel8                                                                                                    

Transaction Summary
====================================================================================================================================================================================
Install  14 Packages

Total download size: 103 M
Installed size: 389 M
Is this ok [y/N]: y
Downloading Packages:
(1/14): fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64.rpm                                                                               5.5 MB/s |  73 kB     00:00    
(2/14): container-selinux-2.167.0-1.module_el8.5.0+911+f19012f9.noarch.rpm                                                                          1.8 MB/s |  54 kB     00:00    
(3/14): libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64.rpm                                                                                     2.2 MB/s |  70 kB     00:00    
(4/14): slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64.rpm                                                                                  1.9 MB/s |  51 kB     00:00    
(5/14): fuse-common-3.2.1-12.el8.x86_64.rpm                                                                                                         669 kB/s |  21 kB     00:00    
(6/14): fuse3-libs-3.2.1-12.el8.x86_64.rpm                                                                                                          4.1 MB/s |  94 kB     00:00    
(7/14): fuse3-3.2.1-12.el8.x86_64.rpm                                                                                                               1.4 MB/s |  50 kB     00:00    
(8/14): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                            6.2 MB/s |  70 kB     00:00    
(9/14): docker-ce-26.1.0-1.el8.x86_64.rpm                                                                                                           604 kB/s |  27 MB     00:46    
(10/14): containerd.io-1.6.31-3.1.el8.x86_64.rpm                                                                                                    488 kB/s |  35 MB     01:13    
(11/14): docker-ce-cli-26.1.0-1.el8.x86_64.rpm                                                                                                      239 kB/s | 7.8 MB     00:33    
(12/14): docker-ce-rootless-extras-26.1.0-1.el8.x86_64.rpm                                                                                          225 kB/s | 5.0 MB     00:22    
(13/14): docker-compose-plugin-2.26.1-1.el8.x86_64.rpm                                                                                              206 kB/s |  13 MB     01:06    
(14/14): docker-buildx-plugin-0.14.0-1.el8.x86_64.rpm                                                                                                19 kB/s |  14 MB     12:20    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                               142 kB/s | 103 MB     12:20     
warning: /var/cache/dnf/docker-ce-stable-fa9dc42ab4cec2f4/packages/containerd.io-1.6.31-3.1.el8.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                                                                           1.7 kB/s | 1.6 kB     00:00    
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/centos/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 
  Installing       : docker-compose-plugin-2.26.1-1.el8.x86_64                                                                                                                 1/14 
  Running scriptlet: docker-compose-plugin-2.26.1-1.el8.x86_64                                                                                                                 1/14 
  Running scriptlet: container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch                                                                                          2/14 
  Installing       : container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch                                                                                          2/14 
  Running scriptlet: container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch                                                                                          2/14 
  Installing       : containerd.io-1.6.31-3.1.el8.x86_64                                                                                                                       3/14 
  Running scriptlet: containerd.io-1.6.31-3.1.el8.x86_64                                                                                                                       3/14 
  Installing       : docker-buildx-plugin-0.14.0-1.el8.x86_64                                                                                                                  4/14 
  Running scriptlet: docker-buildx-plugin-0.14.0-1.el8.x86_64                                                                                                                  4/14 
  Installing       : docker-ce-cli-1:26.1.0-1.el8.x86_64                                                                                                                       5/14 
  Running scriptlet: docker-ce-cli-1:26.1.0-1.el8.x86_64                                                                                                                       5/14 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                              6/14 
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                                                                              6/14 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                              6/14 
  Installing       : fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                            7/14 
  Running scriptlet: fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                            7/14 
  Installing       : fuse-common-3.2.1-12.el8.x86_64                                                                                                                           8/14 
  Installing       : fuse3-3.2.1-12.el8.x86_64                                                                                                                                 9/14 
  Installing       : fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64                                                                                                10/14 
  Running scriptlet: fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64                                                                                                10/14 
  Installing       : libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64                                                                                                      11/14 
  Installing       : slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64                                                                                                   12/14 
  Installing       : docker-ce-rootless-extras-26.1.0-1.el8.x86_64                                                                                                            13/14 
  Running scriptlet: docker-ce-rootless-extras-26.1.0-1.el8.x86_64                                                                                                            13/14 
  Installing       : docker-ce-3:26.1.0-1.el8.x86_64                                                                                                                          14/14 
  Running scriptlet: docker-ce-3:26.1.0-1.el8.x86_64                                                                                                                          14/14 
  Running scriptlet: container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch                                                                                         14/14 
  Running scriptlet: docker-ce-3:26.1.0-1.el8.x86_64                                                                                                                          14/14 
  Verifying        : container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch                                                                                          1/14 
  Verifying        : fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64                                                                                                 2/14 
  Verifying        : libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64                                                                                                       3/14 
  Verifying        : slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64                                                                                                    4/14 
  Verifying        : fuse-common-3.2.1-12.el8.x86_64                                                                                                                           5/14 
  Verifying        : fuse3-3.2.1-12.el8.x86_64                                                                                                                                 6/14 
  Verifying        : fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                            7/14 
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                                                                              8/14 
  Verifying        : containerd.io-1.6.31-3.1.el8.x86_64                                                                                                                       9/14 
  Verifying        : docker-buildx-plugin-0.14.0-1.el8.x86_64                                                                                                                 10/14 
  Verifying        : docker-ce-3:26.1.0-1.el8.x86_64                                                                                                                          11/14 
  Verifying        : docker-ce-cli-1:26.1.0-1.el8.x86_64                                                                                                                      12/14 
  Verifying        : docker-ce-rootless-extras-26.1.0-1.el8.x86_64                                                                                                            13/14 
  Verifying        : docker-compose-plugin-2.26.1-1.el8.x86_64                                                                                                                14/14 

Installed:
  container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch containerd.io-1.6.31-3.1.el8.x86_64                    docker-buildx-plugin-0.14.0-1.el8.x86_64                 
  docker-ce-3:26.1.0-1.el8.x86_64                                  docker-ce-cli-1:26.1.0-1.el8.x86_64                    docker-ce-rootless-extras-26.1.0-1.el8.x86_64            
  docker-compose-plugin-2.26.1-1.el8.x86_64                        fuse-common-3.2.1-12.el8.x86_64                        fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64
  fuse3-3.2.1-12.el8.x86_64                                        fuse3-libs-3.2.1-12.el8.x86_64                         libcgroup-0.41-19.el8.x86_64                             
  libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64              slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64

Complete!

运行

设为自动启动

sudo systemctl start docker
sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

验证

sudo docker --version
Docker version 26.1.0, build 9714adc
centos 8.4 安装 docker

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Scroll to top
粤ICP备2020114259号 粤公网安备44030402004258