- 卸载Docker
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
docker-ce
- 安装docker
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2 --skip-broken
- 然后更新本地镜像源
# 设置docker镜像源
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
更新完成后执行: yum install -y docker-ce
- 启动docker 4.1 关闭防火墙
关闭
systemctl stop firewalld
禁止开机启动
systemctl disable firewalld
查看是否关闭防火墙
systemctl status firewalld
4.2 启动docker
启动docker服务
systemctl start docker
停止docker服务
systemctl stop docker
重启docker服务
systemctl restart docker
docker -v # 查看docker版本
- 配置镜像加速 docker官方镜像仓库网速较差,我们需要设置国内镜像服务
创建文件夹
sudo mkdir -p /etc/docker
在文件夹内新建一个daemon.json文件
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://akchsmlh.mirror.aliyuncs.com"]
}
EOF
重新加载文件
sudo systemctl daemon-reload
重启docker
sudo systemctl restart docker
标签:ce,repo,systemctl,yum,linux,镜像,docker,安装
From: https://blog.51cto.com/u_16164025/6505115