安装Docker详细步骤
1.更新yum源
sudo yum update
2.卸载旧版本的Docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
3.更改yum源为国内源
阿里云:
sudo yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
官方源:
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4.安装Docker依赖包
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
5.安装Docker
sudo yum install docker-ce docker-ce-cli containerd.io
6.启动Docker
sudo systemctl start docker
7.设置Docker开机自启
sudo systemctl enable docker
卸载Docker
卸载全部相关软件包文章来源:https://www.toymoban.com/news/detail-739804.html
sudo yum remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
删除所有镜像、容器、卷文章来源地址https://www.toymoban.com/news/detail-739804.html
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
到了这里,关于基于CentOS的Docker安装教程的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!