问题
参考网上文章给 Docker 换源之后,再次启动报错,如下:
[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sat 2024-05-25 00:14:24 CST; 18s ago
Docs: https://docs.docker.com
Process: 6975 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 6975 (code=exited, status=1/FAILURE)
May 25 00:14:22 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
May 25 00:14:22 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
May 25 00:14:22 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
May 25 00:14:22 localhost.localdomain systemd[1]: docker.service failed.
May 25 00:14:24 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
May 25 00:14:24 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
May 25 00:14:24 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
May 25 00:14:24 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
May 25 00:14:24 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
May 25 00:14:24 localhost.localdomain systemd[1]: docker.service failed.
解决方法
在还原过程中配置了国内镜像,并且镜像文件为/etc/docker/daemon.json,就会导致启动失败问题
将文件后缀修改为为.conf,即可正常启动docker 服务
[root@localhost ~]# cd /etc/docker/
[root@localhost docker]# ll
total 4
-rw-r--r--. 1 root root 53 May 25 00:05 daemon.json
[root@localhost docker]# mv daemon.json daemon.conf
[root@localhost docker]# cd
[root@localhost ~]# systemctl start docker
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
daocloud.io/library/redis latest a617c1c92774 3 years ago 105MB
daocloud.io/library/nginx latest 298ec0e28760 3 years ago 133MB