当前位置:   article > 正文

Redhat7.9上安装Docker_redhat 安装docker

redhat 安装docker

Redhat7.9上安装Docker

一、linux环境说明

Red Hat Enterprise Linux 7.9 下载后(见参考1),vmware安装虚拟机

[root@localhost /]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
[root@localhost /]#  cat /proc/version
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@x86-vm-26.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Aug 18 14:50:17 EDT 2020
  • 1
  • 2
  • 3
  • 4

二、离线安装docker

step1:Uninstall old versions 卸载老版本

yum remove docker \
            docker-client \
            docker-client-latest \
            docker-common \
            docker-latest \
            docker-latest-logrotate \
            docker-logrotate \
            docker-engine
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

step2:离线安装docker相关组件

如果在线安装latest版本命令为:yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

前往网址https://download.docker.com/linux/centos/7/x86_64/stable/Packages/下载相应的rpm包,并将相关rpm包放置在指定文件夹下,如/opt/findig/PYTHON/docker-rpm/

cd /opt/findig/PYTHON/docker-rpm/

yum install docker-ce-rootless-extras-23.0.3-1.el7.x86_64.rpm docker-ce-23.0.3-1.el7.x86_64.rpm docker-ce-cli-23.0.3-1.el7.x86_64.rpm containerd.io-1.6.9-3.1.el7.x86_64.rpm docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm docker-compose-plugin-2.6.0-3.el7.x86_64.rpm

#docker-ce-rootless-extras-23.0.3-1.el7.x86_64.rpm 是由于安装报错Error: Package: 3:docker-ce-23.0.3-1.el7.x86_64 (/docker-ce-23.0.3-1.el7.x86_64),Requires: docker-ce-rootless-extras
#安装时显示需要依赖其他的yum包,但是内网是非在线环境,不定能yum这些包,因此这个问题后续需要继续留意。on todo list

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
yum install docker-ce-rootless-extras-23.0.3-1.el7.x86_64.rpm docker-ce-23.0.3-1.el7.x86_64.rpm docker-ce-cli-23.0.3-1.el7.x86_64.rpm containerd.io-1.6.9-3.1.el7.x86_64.rpm docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm docker-compose-plugin-2.6.0-3.el7.x86_64.rpm
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Repository base is listed more than once in the configuration
Examining docker-ce-rootless-extras-23.0.3-1.el7.x86_64.rpm: docker-ce-rootless-extras-23.0.3-1.el7.x86_64
Marking docker-ce-rootless-extras-23.0.3-1.el7.x86_64.rpm to be installed
Examining docker-ce-23.0.3-1.el7.x86_64.rpm: 3:docker-ce-23.0.3-1.el7.x86_64
Marking docker-ce-23.0.3-1.el7.x86_64.rpm to be installed
Examining docker-ce-cli-23.0.3-1.el7.x86_64.rpm: 1:docker-ce-cli-23.0.3-1.el7.x86_64
Marking docker-ce-cli-23.0.3-1.el7.x86_64.rpm to be installed
Examining containerd.io-1.6.9-3.1.el7.x86_64.rpm: containerd.io-1.6.9-3.1.el7.x86_64
Marking containerd.io-1.6.9-3.1.el7.x86_64.rpm to be installed
Examining docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm: docker-buildx-plugin-0.10.4-1.el7.x86_64
Marking docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm to be installed
Examining docker-compose-plugin-2.6.0-3.el7.x86_64.rpm: docker-compose-plugin-2.6.0-3.el7.x86_64
Marking docker-compose-plugin-2.6.0-3.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package containerd.io.x86_64 0:1.6.9-3.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.6.9-3.1.el7.x86_64
Loading mirror speeds from cached hostfile
 * elrepo: mirrors.tuna.tsinghua.edu.cn
---> Package docker-buildx-plugin.x86_64 0:0.10.4-1.el7 will be installed
---> Package docker-ce.x86_64 3:23.0.3-1.el7 will be installed
---> Package docker-ce-cli.x86_64 1:23.0.3-1.el7 will be installed
---> Package docker-ce-rootless-extras.x86_64 0:23.0.3-1.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-23.0.3-1.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-23.0.3-1.el7.x86_64
---> Package docker-compose-plugin.x86_64 0:2.6.0-3.el7 will be installed
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Running transaction check
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                Arch   Version         Repository                                      Size
====================================================================================================
Installing:
 containerd.io          x86_64 1.6.9-3.1.el7   /containerd.io-1.6.9-3.1.el7.x86_64            112 M
 docker-buildx-plugin   x86_64 0.10.4-1.el7    /docker-buildx-plugin-0.10.4-1.el7.x86_64       53 M
 docker-ce              x86_64 3:23.0.3-1.el7  /docker-ce-23.0.3-1.el7.x86_64                  94 M
 docker-ce-cli          x86_64 1:23.0.3-1.el7  /docker-ce-cli-23.0.3-1.el7.x86_64              34 M
 docker-ce-rootless-extras
                        x86_64 23.0.3-1.el7    /docker-ce-rootless-extras-23.0.3-1.el7.x86_64  19 M
 docker-compose-plugin  x86_64 2.6.0-3.el7     /docker-compose-plugin-2.6.0-3.el7.x86_64       25 M
Installing for dependencies:
 container-selinux      noarch 2:2.119.2-1.911c772.el7_8
                                               extras                                          40 k
 fuse-overlayfs         x86_64 0.7.2-6.el7_8   extras                                          54 k
 fuse3-libs             x86_64 3.6.1-4.el7     extras                                          82 k
 slirp4netns            x86_64 0.4.3-4.el7_8   extras                                          81 k

Transaction Summary
====================================================================================================
Install  6 Packages (+4 Dependent packages)

Total size: 338 M
Total download size: 218 k
Installed size: 339 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                               |  54 kB  00:00:02
(2/3): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                  |  81 kB  00:00:00
(3/3): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                     |  82 kB  00:00:02
----------------------------------------------------------------------------------------------------
Total                                                                79 kB/s | 218 kB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                              1/10
  Installing : containerd.io-1.6.9-3.1.el7.x86_64                                              2/10
  Installing : docker-compose-plugin-2.6.0-3.el7.x86_64                                        3/10
  Installing : slirp4netns-0.4.3-4.el7_8.x86_64                                                4/10
  Installing : docker-buildx-plugin-0.10.4-1.el7.x86_64                                        5/10
  Installing : 1:docker-ce-cli-23.0.3-1.el7.x86_64                                             6/10
  Installing : fuse3-libs-3.6.1-4.el7.x86_64                                                   7/10
  Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                             8/10
  Installing : docker-ce-rootless-extras-23.0.3-1.el7.x86_64                                   9/10
  Installing : 3:docker-ce-23.0.3-1.el7.x86_64                                                10/10
  Verifying  : containerd.io-1.6.9-3.1.el7.x86_64                                              1/10
  Verifying  : fuse3-libs-3.6.1-4.el7.x86_64                                                   2/10
  Verifying  : 1:docker-ce-cli-23.0.3-1.el7.x86_64                                             3/10
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                             4/10
  Verifying  : docker-ce-rootless-extras-23.0.3-1.el7.x86_64                                   5/10
  Verifying  : docker-buildx-plugin-0.10.4-1.el7.x86_64                                        6/10
  Verifying  : 3:docker-ce-23.0.3-1.el7.x86_64                                                 7/10
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                              8/10
  Verifying  : slirp4netns-0.4.3-4.el7_8.x86_64                                                9/10
  Verifying  : docker-compose-plugin-2.6.0-3.el7.x86_64                                       10/10

Installed:
  containerd.io.x86_64 0:1.6.9-3.1.el7                docker-buildx-plugin.x86_64 0:0.10.4-1.el7
  docker-ce.x86_64 3:23.0.3-1.el7                     docker-ce-cli.x86_64 1:23.0.3-1.el7
  docker-ce-rootless-extras.x86_64 0:23.0.3-1.el7     docker-compose-plugin.x86_64 0:2.6.0-3.el7

Dependency Installed:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8      fuse-overlayfs.x86_64 0:0.7.2-6.el7_8
  fuse3-libs.x86_64 0:3.6.1-4.el7                         slirp4netns.x86_64 0:0.4.3-4.el7_8

Complete!

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113

step3:启动docker服务

systemctl start docker
  • 1
step4:检查docker服务启动情况
docker run hello-world 
# Unable to find image 'hello-world:latest' locally,可用下面的语句验证
docker ps  
#CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
docker images 
#REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
systemctl status docker
whereis docker
# docker ps | docker images  | systemctl status docker | whereis docker 有结果后表示安装正常

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
[root@localhost docker-rpm]# whereis docker
docker: /usr/bin/docker /etc/docker /usr/libexec/docker /usr/share/man/man1/docker.1.gz
[root@localhost docker-rpm]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-04-10 04:25:46 PDT; 2min 34s ago
     Docs: https://docs.docker.com
 Main PID: 92125 (dockerd)
    Tasks: 7
   Memory: 31.5M
   CGroup: /system.slice/docker.service
           └─92125 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Apr 10 04:25:45 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:45.230522695-07:00.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.321515837-07:00.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.487530628-07:00.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.563220401-07:00.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.585376472-07:00.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.585494949-07:00.
Apr 10 04:25:46 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.600629950-07:00.
Apr 10 04:25:46 localhost.localdomain dockerd[92125]: time="2023-04-10T04:25:46.609774794-07:00.
Apr 10 04:27:21 localhost.localdomain dockerd[92125]: time="2023-04-10T04:27:21.355834152-07:00.
Hint: Some lines were ellipsized, use -l to show in full.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
step5:用image验证
待补充
  • 1

参考

1、https://cloud.tencent.com/developer/article/2080004 Red Hat Enterprise Linux 7.9 下载

2、https://blog.csdn.net/lyqhf153/article/details/79585976 在Redhat/CentOS上安装Docker

3、https://docs.docker.com/engine/install/centos/ Install Docker Engine on CentOS :官网!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/576182
推荐阅读
相关标签
  

闽ICP备14008679号