REHL 8安装docker
参考官方文档:https://docs.docker.com/engine/install/rhel/
1.卸载旧版本docker,包括rehl自带的podman
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc
清理旧的目录数据
rm -rf /var/lib/docker
2.添加docker-ce repo
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
或者手动添加配置文件
cat >/etc/yum.repos.d/docker.repo<<EOF
[docker-ce-edge]
name=Docker CE Edge - \$basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/\$basearch/edge
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
EOF
3.查看可用docker软件版本
yum list docker-ce --showduplicates | sort -r
4.安装最新版
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
5.安装指定版本
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin
6.启动docker
sudo systemctl start docker && systemctl enable docker
7.测试docker
sudo docker run hello-world