这里列举一些docker常见的错误和解决方案:
错误:Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
这个一般是由于/etc/docker/daemon.json里面配置有误
正确配置例子:
cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"insecure-registries":["127.0.0.1"]
}
错误:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
使配置文件生效:
sudo systemctl daemon-reload
重启docker:
sudo service docker restart