刚刚弄了docker重启了一下,本来启动得好好的,重启系统后就不行了

一直给我报错

最开始是这样的

[root@server run]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2017-12-14 10:56:34 EST; 2min 38s ago
     Docs: http://docs.docker.com
  Process: 10755 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 10755 (code=exited, status=1/FAILURE)

Dec 14 10:56:33 server systemd[1]: Starting Docker Application Container Engine...
Dec 14 10:56:33 server docker-current[10755]: time="2017-12-14T10:56:33.627099954-05:00" level=warning msg="devmapper: Usage of loopback devices is strongly discou...v section."
Dec 14 10:56:33 server docker-current[10755]: time="2017-12-14T10:56:33.643888204-05:00" level=info msg="devmapper: Creating filesystem xfs on device docker-253:0-...61896-base"
Dec 14 10:56:34 server docker-current[10755]: time="2017-12-14T10:56:34.163161282-05:00" level=info msg="devmapper: Successfully created filesystem xfs on device d...61896-base"
Dec 14 10:56:34 server docker-current[10755]: time="2017-12-14T10:56:34.290819345-05:00" level=warning msg="Docker could not enable SELinux on the host system"
Dec 14 10:56:34 server docker-current[10755]: time="2017-12-14T10:56:34.325390849-05:00" level=fatal msg="Error starting daemon: Error loading key file /etc/docker...ON input\n"
Dec 14 10:56:34 server systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 14 10:56:34 server systemd[1]: Failed to start Docker Application Container Engine.
Dec 14 10:56:34 server systemd[1]: Unit docker.service entered failed state.
Dec 14 10:56:34 server systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

给我提示 msg="Error starting daemon: Error loading key file /etc/docker...ON input\n"

我开始也没有在意,一直在用网上的方法试什么删除/var/run/docker.sock,或者是删除rm -rf /var/lib/docker/

最着不住的是居然看见有人说再重启系统后就能成功,简直是。。。。惊恐可怕!!

当然以上都没有成功。。。


然后报错信息突然变了

[root@server ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2017-12-14 11:10:24 EST; 36s ago
     Docs: http://docs.docker.com
  Process: 2403 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 2403 (code=exited, status=1/FAILURE)

Dec 14 11:10:24 server systemd[1]: Starting Docker Application Container Engine...
Dec 14 11:10:24 server docker-current[2403]: time="2017-12-14T11:10:24.532194806-05:00" level=warning msg="devmapper: Usage of loopback devices is strongly discouraged for production use. Plea...ldev section."
Dec 14 11:10:24 server docker-current[2403]: time="2017-12-14T11:10:24.547180234-05:00" level=warning msg="devmapper: Base device already exists and has filesystem xfs on it. User specified fi...l be ignored."
Dec 14 11:10:24 server docker-current[2403]: time="2017-12-14T11:10:24.554895833-05:00" level=info msg="[graphdriver] using prior storage driver \"devicemapper\""
Dec 14 11:10:24 server docker-current[2403]: time="2017-12-14T11:10:24.555289136-05:00" level=warning msg="Docker could not enable SELinux on the host system"
Dec 14 11:10:24 server docker-current[2403]: time="2017-12-14T11:10:24.885244154-05:00" level=fatal msg="Error starting daemon: Error loading key file /etc/docker/key.json: unable to decode pr... JSON input\n"
Dec 14 11:10:24 server systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 14 11:10:24 server systemd[1]: Failed to start Docker Application Container Engine.
Dec 14 11:10:24 server systemd[1]: Unit docker.service entered failed state.
Dec 14 11:10:24 server systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
level=fatal msg="Error starting daemon: Error loading key file /etc/docker/key.json: unable to decode pr... JSON input\n"
我去这次显示得如此清楚,以前的那个我就没有注意看。。。
尴尬

解决方法:当然是删除key.json

[root@registry run]# rm /etc/docker/key.json 
rm: remove regular empty file ‘/etc/docker/key.json’? y
[root@registry run]# systemctl start docker.service


本来我以为我写完了,然后我发现我另外几台删了也启动不了。。。

请把rm -rf /var/lib/docker/一并删除

[root@client1 ~]# rm /etc/docker/key.json 
rm: remove regular empty file ‘/etc/docker/key.json’? y
[root@client1 ~]# systemctl restart 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@client1 ~]# rm -rf /var/lib/docker/
[root@client1 ~]# systemctl restart docker

解决问题,看来以后得多注意下细节


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐