2023年3月25日 星期六

[研究]docker 23.0.1 安裝 (Rocky Linux 9.1)

[研究]docker 23.0.1 安裝 (Rocky Linux 9.1)

2023-03-25

參考

Install Docker Engine on CentOS | Docker Documentation
https://docs.docker.com/engine/install/centos/

精簡彙整安裝過程

sudo yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine 

sudo yum install -y yum-utils

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

dnf list docker-ce --showduplicates | sort -r (敝人額外參考)

sudo yum erase -y podman buildah

sudo yum install -y docker-ce docker-ce-cli containerd.io

sudo systemctl enable docker

sudo systemctl start docker

docker --version  

********************************************************************************

移除舊 docker

[user1@localhost ~]$ sudo yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine 

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for user1: 
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!
[user1@localhost ~]$ 

為了有 yum-config-manager ,安裝 yum-utils

[user1@localhost ~]$ sudo yum install -y yum-utils
Rocky Linux 9 - BaseOS                          806 kB/s | 1.8 MB     00:02    
Rocky Linux 9 - AppStream                       688 kB/s | 6.6 MB     00:09    
Rocky Linux 9 - Extras                          2.6 kB/s | 8.5 kB     00:03    
Dependencies resolved.
================================================================================
 Package            Architecture    Version               Repository       Size
================================================================================
Installing:
 yum-utils          noarch          4.1.0-3.el9           baseos           36 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 36 k
Installed size: 23 k
Downloading Packages:
yum-utils-4.1.0-3.el9.noarch.rpm                210 kB/s |  36 kB     00:00    
--------------------------------------------------------------------------------
Total                                            35 kB/s |  36 kB     00:01     
Rocky Linux 9 - BaseOS                          1.7 MB/s | 1.7 kB     00:00    
Importing GPG key 0x350D275D:
 Userid     : "Rocky Enterprise Software Foundation - Release key 2022 <releng@rockylinux.org>"
 Fingerprint: 21CB 256A E16F C54C 6E65 2949 702D 426D 350D 275D
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : yum-utils-4.1.0-3.el9.noarch                           1/1 
  Running scriptlet: yum-utils-4.1.0-3.el9.noarch                           1/1 
  Verifying        : yum-utils-4.1.0-3.el9.noarch                           1/1 

Installed:
  yum-utils-4.1.0-3.el9.noarch                                                  

Complete!
[user1@localhost ~]$ 


用 yum-config-manager 設定  Repository

[user1@localhost ~]$ 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
[user1@localhost ~]$ 

目前提供的

[user1@localhost ~]$ dnf list docker-ce --showduplicates | sort -r
Rocky Linux 9 - Extras                          2.7 kB/s | 2.9 kB     00:01    
Rocky Linux 9 - BaseOS                          908 kB/s | 1.8 MB     00:02    
Rocky Linux 9 - BaseOS                          4.4 kB/s | 4.1 kB     00:00    
Rocky Linux 9 - AppStream                       4.7 kB/s | 4.5 kB     00:00    
Rocky Linux 9 - AppStream                       1.3 MB/s | 6.6 MB     00:04    
Installed Packages
docker-ce.x86_64               3:23.0.1-1.el9                  docker-ce-stable 
docker-ce.x86_64               3:23.0.1-1.el9                  @docker-ce-stable
docker-ce.x86_64               3:23.0.0-1.el9                  docker-ce-stable 
docker-ce.x86_64               3:20.10.23-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.22-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.21-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.20-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.19-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.18-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.17-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.16-3.el9                docker-ce-stable 
docker-ce.x86_64               3:20.10.15-3.el9                docker-ce-stable 
Docker CE Stable - x86_64                        84 kB/s |  19 kB     00:00    
Available Packages
[user1@localhost ~]$ 

移除有問題的 podman

[user1@localhost ~]$ sudo yum erase -y podman buildah
Dependencies resolved.
================================================================================
 Package                Arch       Version                 Repository      Size
================================================================================
Removing:
 buildah                x86_64     1:1.27.2-2.el9_1        @AppStream      26 M
 podman                 x86_64     2:4.2.0-7.el9_1         @AppStream      41 M
Removing dependent packages:
 cockpit-podman         noarch     53-1.el9                @AppStream     548 k
Removing unused dependencies:
 aardvark-dns           x86_64     2:1.1.0-5.el9_1         @AppStream     3.2 M
 conmon                 x86_64     2:2.1.4-1.el9           @AppStream     170 k
 container-selinux      noarch     3:2.189.0-1.el9         @AppStream      57 k
 containers-common      x86_64     2:1-45.el9_1            @AppStream     409 k
 criu                   x86_64     3.17-4.el9              @AppStream     1.5 M
 criu-libs              x86_64     3.17-4.el9              @AppStream      85 k
 crun                   x86_64     1.5-1.el9               @AppStream     430 k
 fuse-overlayfs         x86_64     1.9-1.el9               @AppStream     148 k
 libnet                 x86_64     1.2-6.el9               @AppStream     128 k
 libslirp               x86_64     4.4.0-7.el9             @AppStream     133 k
 netavark               x86_64     2:1.1.0-7.el9_1         @AppStream     8.7 M
 podman-catatonit       x86_64     2:4.2.0-7.el9_1         @AppStream     833 k
 runc                   x86_64     4:1.1.4-1.el9_1         @AppStream     9.5 M
 shadow-utils-subid     x86_64     2:4.9-5.el9             @anaconda      217 k
 slirp4netns            x86_64     1.2.0-2.el9             @AppStream      94 k
 yajl                   x86_64     2.1.0-21.el9            @AppStream      91 k

Transaction Summary
================================================================================
Remove  19 Packages

Freed space: 93 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Erasing          : buildah-1:1.27.2-2.el9_1.x86_64                       1/19 
  Erasing          : cockpit-podman-53-1.el9.noarch                        2/19 
  Running scriptlet: podman-2:4.2.0-7.el9_1.x86_64                         3/19 
  Erasing          : podman-2:4.2.0-7.el9_1.x86_64                         3/19 
  Erasing          : containers-common-2:1-45.el9_1.x86_64                 4/19 
  Erasing          : slirp4netns-1.2.0-2.el9.x86_64                        5/19 
  Erasing          : crun-1.5-1.el9.x86_64                                 6/19 
  Erasing          : criu-libs-3.17-4.el9.x86_64                           7/19 
  Erasing          : netavark-2:1.1.0-7.el9_1.x86_64                       8/19 
  Erasing          : runc-4:1.1.4-1.el9_1.x86_64                           9/19 
  Erasing          : container-selinux-3:2.189.0-1.el9.noarch             10/19 
  Running scriptlet: container-selinux-3:2.189.0-1.el9.noarch             10/19 
  Erasing          : podman-catatonit-2:4.2.0-7.el9_1.x86_64              11/19 
  Erasing          : criu-3.17-4.el9.x86_64                               12/19 
  Erasing          : libnet-1.2-6.el9.x86_64                              13/19 
  Erasing          : aardvark-dns-2:1.1.0-5.el9_1.x86_64                  14/19 
  Erasing          : yajl-2.1.0-21.el9.x86_64                             15/19 
  Erasing          : libslirp-4.4.0-7.el9.x86_64                          16/19 
  Erasing          : fuse-overlayfs-1.9-1.el9.x86_64                      17/19 
  Erasing          : conmon-2:2.1.4-1.el9.x86_64                          18/19 
  Erasing          : shadow-utils-subid-2:4.9-5.el9.x86_64                19/19 
  Running scriptlet: shadow-utils-subid-2:4.9-5.el9.x86_64                19/19 
  Verifying        : aardvark-dns-2:1.1.0-5.el9_1.x86_64                   1/19 
  Verifying        : buildah-1:1.27.2-2.el9_1.x86_64                       2/19 
  Verifying        : cockpit-podman-53-1.el9.noarch                        3/19 
  Verifying        : conmon-2:2.1.4-1.el9.x86_64                           4/19 
  Verifying        : container-selinux-3:2.189.0-1.el9.noarch              5/19 
  Verifying        : containers-common-2:1-45.el9_1.x86_64                 6/19 
  Verifying        : criu-3.17-4.el9.x86_64                                7/19 
  Verifying        : criu-libs-3.17-4.el9.x86_64                           8/19 
  Verifying        : crun-1.5-1.el9.x86_64                                 9/19 
  Verifying        : fuse-overlayfs-1.9-1.el9.x86_64                      10/19 
  Verifying        : libnet-1.2-6.el9.x86_64                              11/19 
  Verifying        : libslirp-4.4.0-7.el9.x86_64                          12/19 
  Verifying        : netavark-2:1.1.0-7.el9_1.x86_64                      13/19 
  Verifying        : podman-2:4.2.0-7.el9_1.x86_64                        14/19 
  Verifying        : podman-catatonit-2:4.2.0-7.el9_1.x86_64              15/19 
  Verifying        : runc-4:1.1.4-1.el9_1.x86_64                          16/19 
  Verifying        : shadow-utils-subid-2:4.9-5.el9.x86_64                17/19 
  Verifying        : slirp4netns-1.2.0-2.el9.x86_64                       18/19 
  Verifying        : yajl-2.1.0-21.el9.x86_64                             19/19 

Removed:
  aardvark-dns-2:1.1.0-5.el9_1.x86_64                                           
  buildah-1:1.27.2-2.el9_1.x86_64                                               
  cockpit-podman-53-1.el9.noarch                                                
  conmon-2:2.1.4-1.el9.x86_64                                                   
  container-selinux-3:2.189.0-1.el9.noarch                                      
  containers-common-2:1-45.el9_1.x86_64                                         
  criu-3.17-4.el9.x86_64                                                        
  criu-libs-3.17-4.el9.x86_64                                                   
  crun-1.5-1.el9.x86_64                                                         
  fuse-overlayfs-1.9-1.el9.x86_64                                               
  libnet-1.2-6.el9.x86_64                                                       
  libslirp-4.4.0-7.el9.x86_64                                                   
  netavark-2:1.1.0-7.el9_1.x86_64                                               
  podman-2:4.2.0-7.el9_1.x86_64                                                 
  podman-catatonit-2:4.2.0-7.el9_1.x86_64                                       
  runc-4:1.1.4-1.el9_1.x86_64                                                   
  shadow-utils-subid-2:4.9-5.el9.x86_64                                         
  slirp4netns-1.2.0-2.el9.x86_64                                                
  yajl-2.1.0-21.el9.x86_64                                                      

Complete!
[user1@localhost ~]$ 


安裝 Docker Engine ( 引擎)

[user1@localhost ~]$ sudo yum install -y docker-ce docker-ce-cli containerd.io
Docker CE Stable - x86_64                        82 kB/s |  19 kB     00:00    
Dependencies resolved.
================================================================================
 Package                    Arch    Version             Repository         Size
================================================================================
Installing:
 containerd.io              x86_64  1.6.19-3.1.el9      docker-ce-stable   32 M
 docker-ce                  x86_64  3:23.0.1-1.el9      docker-ce-stable   23 M
 docker-ce-cli              x86_64  1:23.0.1-1.el9      docker-ce-stable  7.0 M
Installing dependencies:
 container-selinux          noarch  3:2.189.0-1.el9     appstream          47 k
 docker-ce-rootless-extras  x86_64  23.0.1-1.el9        docker-ce-stable  3.8 M
 fuse-overlayfs             x86_64  1.9-1.el9           appstream          71 k
 libslirp                   x86_64  4.4.0-7.el9         appstream          68 k
 slirp4netns                x86_64  1.2.0-2.el9         appstream          46 k
Installing weak dependencies:
 docker-buildx-plugin       x86_64  0.10.2-1.el9        docker-ce-stable   12 M
 docker-compose-plugin      x86_64  2.16.0-1.el9        docker-ce-stable   11 M
 docker-scan-plugin         x86_64  0.23.0-3.el9        docker-ce-stable  3.8 M

Transaction Summary
================================================================================
Install  11 Packages

Total download size: 93 M
Installed size: 361 M
Downloading Packages:
(1/11): docker-buildx-plugin-0.10.2-1.el9.x86_6 2.1 MB/s |  12 MB     00:05    
(2/11): docker-ce-23.0.1-1.el9.x86_64.rpm       2.6 MB/s |  23 MB     00:08    
(3/11): docker-ce-cli-23.0.1-1.el9.x86_64.rpm   1.5 MB/s | 7.0 MB     00:04    
(4/11): docker-ce-rootless-extras-23.0.1-1.el9. 1.6 MB/s | 3.8 MB     00:02    
(5/11): docker-scan-plugin-0.23.0-3.el9.x86_64. 1.9 MB/s | 3.8 MB     00:02    
(6/11): container-selinux-2.189.0-1.el9.noarch. 141 kB/s |  47 kB     00:00    
(7/11): fuse-overlayfs-1.9-1.el9.x86_64.rpm     1.2 MB/s |  71 kB     00:00    
(8/11): slirp4netns-1.2.0-2.el9.x86_64.rpm      522 kB/s |  46 kB     00:00    
(9/11): libslirp-4.4.0-7.el9.x86_64.rpm         586 kB/s |  68 kB     00:00    
(10/11): docker-compose-plugin-2.16.0-1.el9.x86 2.3 MB/s |  11 MB     00:04    
(11/11): containerd.io-1.6.19-3.1.el9.x86_64.rp 2.1 MB/s |  32 MB     00:15    
--------------------------------------------------------------------------------
Total                                           5.7 MB/s |  93 MB     00:16     
Docker CE Stable - x86_64                        12 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
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Running scriptlet: container-selinux-3:2.189.0-1.el9.noarch              1/11 
  Installing       : container-selinux-3:2.189.0-1.el9.noarch              1/11 
  Running scriptlet: container-selinux-3:2.189.0-1.el9.noarch              1/11 
  Installing       : docker-scan-plugin-0.23.0-3.el9.x86_64                2/11 
  Running scriptlet: docker-scan-plugin-0.23.0-3.el9.x86_64                2/11 
  Installing       : docker-compose-plugin-2.16.0-1.el9.x86_64             3/11 
  Running scriptlet: docker-compose-plugin-2.16.0-1.el9.x86_64             3/11 
  Installing       : containerd.io-1.6.19-3.1.el9.x86_64                   4/11 
  Running scriptlet: containerd.io-1.6.19-3.1.el9.x86_64                   4/11 
  Installing       : libslirp-4.4.0-7.el9.x86_64                           5/11 
  Installing       : slirp4netns-1.2.0-2.el9.x86_64                        6/11 
  Installing       : fuse-overlayfs-1.9-1.el9.x86_64                       7/11 
  Running scriptlet: fuse-overlayfs-1.9-1.el9.x86_64                       7/11 
  Installing       : docker-buildx-plugin-0.10.2-1.el9.x86_64              8/11 
  Running scriptlet: docker-buildx-plugin-0.10.2-1.el9.x86_64              8/11 
  Installing       : docker-ce-cli-1:23.0.1-1.el9.x86_64                   9/11 
  Running scriptlet: docker-ce-cli-1:23.0.1-1.el9.x86_64                   9/11 
  Installing       : docker-ce-rootless-extras-23.0.1-1.el9.x86_64        10/11 
  Running scriptlet: docker-ce-rootless-extras-23.0.1-1.el9.x86_64        10/11 
  Installing       : docker-ce-3:23.0.1-1.el9.x86_64                      11/11 
  Running scriptlet: docker-ce-3:23.0.1-1.el9.x86_64                      11/11 
  Running scriptlet: container-selinux-3:2.189.0-1.el9.noarch             11/11 

  Running scriptlet: docker-ce-3:23.0.1-1.el9.x86_64                      11/11 
  Verifying        : containerd.io-1.6.19-3.1.el9.x86_64                   1/11 
  Verifying        : docker-buildx-plugin-0.10.2-1.el9.x86_64              2/11 
  Verifying        : docker-ce-3:23.0.1-1.el9.x86_64                       3/11 
  Verifying        : docker-ce-cli-1:23.0.1-1.el9.x86_64                   4/11 
  Verifying        : docker-ce-rootless-extras-23.0.1-1.el9.x86_64         5/11 
  Verifying        : docker-compose-plugin-2.16.0-1.el9.x86_64             6/11 
  Verifying        : docker-scan-plugin-0.23.0-3.el9.x86_64                7/11 
  Verifying        : container-selinux-3:2.189.0-1.el9.noarch              8/11 
  Verifying        : fuse-overlayfs-1.9-1.el9.x86_64                       9/11 
  Verifying        : slirp4netns-1.2.0-2.el9.x86_64                       10/11 
  Verifying        : libslirp-4.4.0-7.el9.x86_64                          11/11 

Installed:
  container-selinux-3:2.189.0-1.el9.noarch                                      
  containerd.io-1.6.19-3.1.el9.x86_64                                           
  docker-buildx-plugin-0.10.2-1.el9.x86_64                                      
  docker-ce-3:23.0.1-1.el9.x86_64                                               
  docker-ce-cli-1:23.0.1-1.el9.x86_64                                           
  docker-ce-rootless-extras-23.0.1-1.el9.x86_64                                 
  docker-compose-plugin-2.16.0-1.el9.x86_64                                     
  docker-scan-plugin-0.23.0-3.el9.x86_64                                        
  fuse-overlayfs-1.9-1.el9.x86_64                                               
  libslirp-4.4.0-7.el9.x86_64                                                   
  slirp4netns-1.2.0-2.el9.x86_64                                                

Complete!
[user1@localhost ~]$ 
[user1@localhost ~]$ 

設定開機自動啟動 docker

[user1@localhost ~]$ sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[user1@localhost ~]$

立刻啟動 docker

[user1@localhost ~]$ sudo systemctl start docker
[user1@localhost ~]$

檢查狀態

[user1@localhost ~]$ systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pr>
     Active: active (running) since Sat 2023-03-25 08:20:35 CST; 5min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 34811 (dockerd)
      Tasks: 9
     Memory: 28.7M
        CPU: 306ms
     CGroup: /system.slice/docker.service
             └─34811 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/con>

Mar 25 08:20:34 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:34>
Mar 25 08:20:34 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:34>
Mar 25 08:20:34 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:34>
Mar 25 08:20:35 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:35>
Mar 25 08:20:35 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:35>
Mar 25 08:20:35 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:35>
Mar 25 08:20:35 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:35>
Mar 25 08:20:35 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:35>
Mar 25 08:20:35 localhost.localdomain systemd[1]: Started Docker Application Co>
Mar 25 08:20:35 localhost.localdomain dockerd[34811]: time="2023-03-25T08:20:35>
[user1@localhost ~]$ 

檢查版本

[user1@localhost ~]$ docker --version  
Docker version 23.0.1, build a5ee5b1
[user1@localhost ~]$ 

(完)

相關

[研究]docker 23.0.1 安裝 (Rocky Linux 9.1)
https://shaurong.blogspot.com/2023/03/docker-2301-rocky-linux-91.html

[研究]Docker Compose 1.29.2 安裝 (CentOS 8.4)
https://shaurong.blogspot.com/2021/07/docker-compose-centos-84.html

[研究]docker 20.10.7 安裝 (CentOS 8.4)
https://shaurong.blogspot.com/2021/07/docker-centos-84.html

什麼是 Docker? | Microsoft Docs
https://docs.microsoft.com/zh-tw/dotnet/architecture/containerized-lifecycle/what-is-docker

Install Docker Engine on CentOS | Docker Documentation
https://docs.docker.com/engine/install/centos/


沒有留言:

張貼留言