如何让docker引擎重新启动?

如何让docker引擎重新启动?

硬重启后,我的 docker 引擎无法再启动:

$ sudo service docker restart
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

电话如下systemctl

$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fr 2016-11-18 15:11:31 CET; 16s ago
     Docs: https://docs.docker.com
  Process: 4340 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 4340 (code=exited, status=1/FAILURE)

以下是journalctl

$ journalctl -xe
-- Unit docker.socket has begun starting up.
Nov 18 15:11:30 fluttershy systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished starting up.
-- 
-- The start-up result is done.
Nov 18 15:11:30 fluttershy systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has begun starting up.
Nov 18 15:11:30 fluttershy dockerd[4340]: time="2016-11-18T15:11:30.765156842+01:00" level=info msg="libcontainerd: new containerd process, pid: 4349"
Nov 18 15:11:31 fluttershy audit[4361]: AVC apparmor="STATUS" operation="profile_replace" profile="unconfined" name="docker-default" pid=4361 comm="apparmor_p
Nov 18 15:11:31 fluttershy kernel: audit: type=1400 audit(1479478291.790:34): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="docker-
Nov 18 15:11:31 fluttershy dockerd[4340]: time="2016-11-18T15:11:31.799138238+01:00" level=info msg="[graphdriver] using prior storage driver \"aufs\""
Nov 18 15:11:31 fluttershy dockerd[4340]: time="2016-11-18T15:11:31.908304680+01:00" level=fatal msg="Error starting daemon: layer does not exist"
Nov 18 15:11:31 fluttershy systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Nov 18 15:11:31 fluttershy systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Nov 18 15:11:31 fluttershy systemd[1]: docker.service: Unit entered failed state.
Nov 18 15:11:31 fluttershy systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 18 15:11:31 fluttershy sudo[4330]: pam_unix(sudo:session): session closed for user root

我不知道如何继续以及如何让 docker 重新启动。

答案1

作为一个相当激烈的解决方案,我删除了docker的内容:

sudo rm /var/lib/docker/ -rf

我推测我的某些层文件在硬重启期间损坏了,导致 docker start 失败。

指引我往这个方向的一行是:

msg="Error starting daemon: layer does not exist"

但请记住,这将删除您的所有图像和所有构建的容器。您必须再次拉取并构建它们,我不介意。

相关内容