将/etc/docker/daemon.json改成如下:
{
"registry-mirrors":["192.168.8.28:5001"]
}
重启docker的时候报错如下:
[root@localhost docker]# systemctl status docker
â— docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2021-06-09 15:53:13 CST; 45s ago
Docs: https://docs.docker.com
Process: 21348 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 21348 (code=exited, status=1/FAILURE)
6月 09 15:53:13 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
6月 09 15:53:13 localhost.localdomain systemd[1]: docker.service: Start request repeated too quickly.
6月 09 15:53:13 localhost.localdomain systemd[1]: docker.service: Failed with result 'exit-code'.
6月 09 15:53:13 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
6月 09 15:53:13 localhost.localdomain systemd[1]: docker.service: Start request repeated too quickly.
6月 09 15:53:13 localhost.localdomain systemd[1]: docker.service: Failed with result 'exit-code'.
6月 09 15:53:13 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
6月 09 15:53:37 localhost.localdomain systemd[1]: docker.service: Start request repeated too quickly.
6月 09 15:53:37 localhost.localdomain systemd[1]: docker.service: Failed with result 'exit-code'.
6月 09 15:53:37 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
解决方法
daemon.json文件改成如下就可以重启docker了
{
"insecure-registries":["192.168.8.28:5001"]
}