Docker在启动时退出并带有退出代码

时间:2016-10-25 05:47:13

标签: docker service

一旦启动Docker,它就无法启动并说:

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

当我尝试运行命令systemctl status 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.
    shivansh@localhost:~/Documents/Huawei/pulsar/docker-files/pulsarReporting/memcached$ 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 Tue 2016-10-25 11:10:12 IST; 13s ago
         Docs: https://docs.docker.com
      Process: 20514 ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS (code=exited, status=1/FAILURE)
     Main PID: 20514 (code=exited, status=1/FAILURE)

    Oct 25 11:10:11 localhost systemd[1]: Starting Docker Application Container Engine...
    Oct 25 11:10:11 localhost docker[20514]: time="2016-10-25T11:10:11.789509056+05:30" level=info msg="[graphdriver] using prior storage driver \"aufs\""
    Oct 25 11:10:11 localhost docker[20514]: time="2016-10-25T11:10:11.914441951+05:30" level=info msg="Graph migration to content-addressability took 0.00 seconds"
    Oct 25 11:10:11 localhost docker[20514]: time="2016-10-25T11:10:11.918206945+05:30" level=info msg="Firewalld running: false"
    Oct 25 11:10:12 localhost docker[20514]: time="2016-10-25T11:10:12.697748195+05:30" level=fatal msg="Error starting daemon: Error initializing network controller: could not delete the default bridge network: network bridge has acti
    Oct 25 11:10:12 localhost systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
    Oct 25 11:10:12 localhost systemd[1]: Failed to start Docker Application Container Engine.
    Oct 25 11:10:12 localhost systemd[1]: docker.service: Unit entered failed state.
    Oct 25 11:10:12 localhost systemd[1]: docker.service: Failed with result 'exit-code'.

我不知道这里有什么问题。我在Ubuntu 16.04(Xenial Xerus)上使用Docker,我对此很新。我尝试重新启动系统,但它没有帮助。

1 个答案:

答案 0 :(得分:1)

此错误来自daemon/daemon_unix.go

// Clear stale bridge network
    if n, err := controller.NetworkByName("bridge"); err == nil {
        if err = n.Delete(); err != nil {
            return nil, fmt.Errorf("could not delete the default bridge network: %v", err)
        }
}

在您的情况下,完整错误消息为:

Error starting daemon: 
Error initializing network controller: 
could not delete the default bridge network: network bridge has active endpoints

请参阅issue 18283,并在issue 17083

中找到可能的解决方法
sudo rm -r /var/lib/docker/network 

据说,PR 21261解决了一些在非正常守护程序关闭情况下修复活动端点问题的情况。
它仅适用于docker 1.12.2,因此请检查您当前的docker版本。