修改 Docker 的 daemon.json后启动失败

时间:2021-09-01 03:14:50

创建Harbor要把register 换成Harbor地址

vim /etc/docker/daemon.json
添加
{
"insecure-registries":["hub.suntech.com"]
}
重启
systemctl daemon-reload
systemctl restart docker
却总是启动失败

修改 Docker 的 daemon.json后启动失败

发现是insecure-registries 设置冲突造成

vim /usr/lib/systemd/system/docker.service

查看环境变量

EnvironmentFile=-/etc/sysconfig/docker

在/etc/systemconfig/docker里面果然有所发现

OPTIONS='--registry-mirror=https://docker.mirrors.ustc.edu.cn --selinux-enabled --log-driver=journald --signature-verification=false'
ADD_REGISTRY='--add-registry 192.168.1.115:5000'
INSECURE_REGISTRY='--insecure-registry 192.168.1.115:5000'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
fi

将冲突注释,再执行

systemctl daemon-reload
systemctl restart docker OK