Docker启动失败:出现 Job for docker.service 守护进程无法开启解决办法

1.错误:突然提示阿里云的docker容器无法运行并且报错了,错误提示如下:

Welcome to Alibaba Cloud Elastic Compute Service !

[root@liuyan ~]# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docke                                                                                                                 r daemon running?

2.使用命令行启动docker容器报错提示如下
[root@liuyan ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code                                                                                                                 . See "systemctl status docker.service" and "journalctl -xe" for details.
[root@liuyan ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor prese                                                                                                                 t: disabled)
   Active: failed (Result: exit-code) since Wed 2020-09-16 16:44:35 CST; 1min 11                                                                                                                 s ago
     Docs: http://docs.docker.com
  Process: 1560 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/us                                                                                                                 r/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt na                                                                                                                 tive.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy                                                                                                                 -current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/                                                                                                                 etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS                                                                                                                  $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, stat                                                                                                                 us=1/FAILURE)
 Main PID: 1560 (code=exited, status=1/FAILURE)

Sep 16 16:44:35 liuyan systemd[1]: Starting Docker Application Container En.....
Sep 16 16:44:35 liuyan dockerd-current[1560]: unable to configure the Docker...t
Sep 16 16:44:35 liuyan systemd[1]: docker.service: main process exited, cod...RE
Sep 16 16:44:35 liuyan systemd[1]: Failed to start Docker Application Conta...e.
Sep 16 16:44:35 liuyan systemd[1]: Unit docker.service entered failed state.
Sep 16 16:44:35 liuyan systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.


3. 让看详细解释
[root@liuyan ~]# systemctl status docker.service -l
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2020-09-16 16:44:35 CST; 5min ago
     Docs: http://docs.docker.com
  Process: 1560 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
 Main PID: 1560 (code=exited, status=1/FAILURE)

Sep 16 16:44:35 liuyan systemd[1]: Starting Docker Application Container Engine...
Sep 16 16:44:35 liuyan dockerd-current[1560]: unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '"' after array element
Sep 16 16:44:35 liuyan systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Sep 16 16:44:35 liuyan systemd[1]: Failed to start Docker Application Container Engine.
Sep 16 16:44:35 liuyan systemd[1]: Unit docker.service entered failed state.
Sep 16 16:44:35 liuyan systemd[1]: docker.service failed.

4.上面看出这个/etc/docker/seccomp.json这个文件有问题,我们打开编辑器看一下,
[root@liuyan ~]# vim /etc/docker/daemon.json

给文件置空{}

5.重新启动如下:
[root@liuyan ~]# systemctl start docker

6.启动没有报错,正常
[root@liuyan ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

 

你可能感兴趣的:(Docker,docker)