在RedHat上安装docker

在redhat上安装docker

这里基于能正常访问到公网!!!

检查系统内核版本,内核要求高于3.10

[root@ssh-server ~]# uname -r
4.18.0-80.el8.x86_64

设置docker的yum源,方便安装及自动解决依赖

需要确定待安装的机器是否能直接访问外网,否则需要将待安装的docker包及其依赖上传到内部yum仓库或者保存到本地,不做赘述。

[root@ssh-server ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo ##如果没有该命令,请先安装dnf-utils-4.0.2.2-3.el8.noarch
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
[root@ssh-server ~]# yum repolist 
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 1:27:52 ago on Mon 13 Jul 2020 01:16:06 PM CST.
repo id                                                            repo name                                                                                        status
AppStream                                                          App                                                                                              4,672
LiuHaiyang                                                         LiuHaiyang's repo                                                                                1,658
docker-ce-stable                                                   Docker CE Stable - x86_64                                                                           71
epel                                                               Extra Packages for Enterprise Linux 8 - x86_64                                                   5,999
teamviewer                                                         TeamViewer - x86_64                                                                                 93
[root@rhel8 yum.repos.d]# yum list |grep docker #查看新添加的yum源是否有docker镜像
containerd.io.x86_64                                 1.2.0-3.el7                                          docker-ce-stable
docker-ce.x86_64                                     3:19.03.12-3.el7                                     docker-ce-stable
docker-ce-cli.x86_64                                 1:19.03.12-3.el7                                     docker-ce-stable
docker-ce-selinux.noarch                             17.03.3.ce-1.el7                                     docker-ce-stable
pcp-pmda-docker.x86_64                               4.3.0-3.el8                                          AppStream       
podman-docker.noarch                                 1.0.0-2.git921f98f.module+el8+2785+ff8a053f          AppStream       

如果已安装docker需要先卸载

[root@rhel8 yum.repos.d]# rpm -qa|grep docker
podman-docker-1.0.0-2.git921f98f.module+el8+2785+ff8a053f.noarch
[root@rhel8 yum.repos.d]# yum -y remove docker
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Dependencies resolved.
==========================================================================================================================================================================
 Package                            Arch                        Version                                                             Repository                       Size
==========================================================================================================================================================================
Removing:
 podman-docker                      noarch                      1.0.0-2.git921f98f.module+el8+2785+ff8a053f                         @AppStream                      3.5 k

Transaction Summary
==========================================================================================================================================================================
Remove  1 Package

Freed space: 3.5 k
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                  1/1 
  Erasing          : podman-docker-1.0.0-2.git921f98f.module+el8+2785+ff8a053f.noarch                                                                                 1/1 
  Running scriptlet: podman-docker-1.0.0-2.git921f98f.module+el8+2785+ff8a053f.noarch                                                                                 1/1 
  Verifying        : podman-docker-1.0.0-2.git921f98f.module+el8+2785+ff8a053f.noarch                                                                                 1/1 
Installed products updated.

Removed:
  podman-docker-1.0.0-2.git921f98f.module+el8+2785+ff8a053f.noarch                                                                                                        

Complete!

指定安装的docker版本及检查

可先查看yum源中提供的docker的版本

[root@rhel8 yum.repos.d]# yum list docker-ce --showduplicates | sort -r
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值