文章目录
卸载旧版Docker( 如果之前装过Docker的话 )
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
配置Docker的yum库和源sudu
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装Docker
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
启动和校验
# 启动Docker
systemctl start docker
# 停止Docker
systemctl stop docker
# 重启
systemctl restart docker
# 设置开机自启
systemctl enable docker
# 执行docker ps命令,如果不报错,说明安装启动成功
docker ps
配置镜像加速
# 创建目录
mkdir -p /etc/docker
# 复制内容,注意把其中的镜像加速地址改成你自己的
######################## 命令开始 #########################
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou"
]
}
EOF
######################## 命令结束 #########################
# 重新加载配置
systemctl daemon-reload
# 重启Docker
systemctl restart docker
Centos 安装 Docker 就结束啦~
标签:Centos,ce,systemctl,yum,Docker,安装,docker,latest From: https://blog.csdn.net/apple_74262176/article/details/141787597