根据docker官方文档下载Redhat 对应的docker-ce.repo
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
而后安装
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
提示报错:
Errors during downloading metadata for repository 'docker-ce-stable':
- Status code: 404 for https://download.docker.com/linux/rhel/8/x86_64/stable/repodata/repomd.xml (IP: 13.32.121.35)
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@ip-172-18-0-111 yum.repos.d]# vim docker-ce.repo
根据报错提示,打开对应连接确实找不到
实际存在的地址是https://download.docker.com/linux/rhel/8/s390x/stable/repodata/repomd.xml
查其原因,系统为x86非s390x:
解决办法,更换docker的yum源为centos的:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
再次尝试安装docker
sudo yum install docker-engine docker-ce --allowerasing