安装Docker
1、卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2、需要的安装包
yum install -y yum-utils
3、设置镜像的仓库
# 官方仓库
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 阿里云仓库(推荐)
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4、更新 yum 软件包索引
yum makecache fast
5、安装 Docker
yum install docker-ce docker-ce-cli containerd.io
6、启动 Docker
systemctl start docker
7、测试 Docker
docker version
卸载Docker
1、卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
2、删除资源
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
配置阿里云加速器
image.png
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://roj9ny5w.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
网友评论