在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