Docker 自定义网桥后,无法正常启动问题

版权声明:作者:jiankunking 出处:http://blog.csdn.net/jiankunking 本文版权归作者和CSDN共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。 https://blog.csdn.net/xunzaosiyecao/article/details/60587339

周末用docker设置固定ip之后,再次输入启动命令之后,都报错误,具体如下:

root@ubuntu:~# docker version
Client:
 Version:      1.12.6
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   78d1802
 Built:        Tue Jan 31 23:35:14 2017
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
root@ubuntu:~# service docker start
Job for docker.service failed because the control 
process exited with error code. See "systemctl status 
docker.service" and "journalctl -xe" for details.
root@ubuntu:~# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
   Active: failed (Result: exit-code) since Mon 2017-03-06 16:59:47 CST; 29s ago
     Docs: https://docs.docker.com
  Process: 9757 ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS (code=exited, s
 Main PID: 9757 (code=exited, status=1/FAILURE)

Mar 06 16:59:47 ubuntu dockerd[9757]: time="2017-03-06T16:59:47.326263971+08:00"
Mar 06 16:59:47 ubuntu dockerd[9757]: time="2017-03-06T16:59:47.326847904+08:00"
Mar 06 16:59:47 ubuntu dockerd[9757]: time="2017-03-06T16:59:47.327433829+08:00"
Mar 06 16:59:47 ubuntu dockerd[9757]: ........time="2017-03-06T16:59:47.34000826
Mar 06 16:59:47 ubuntu dockerd[9757]: time="2017-03-06T16:59:47.378659103+08:00"
Mar 06 16:59:47 ubuntu dockerd[9757]: time="2017-03-06T16:59:47.401407972+08:00"
Mar 06 16:59:47 ubuntu systemd[1]: docker.service: Main process exited, code=exi
Mar 06 16:59:47 ubuntu systemd[1]: Failed to start Docker Application Container 
Mar 06 16:59:47 ubuntu systemd[1]: docker.service: Unit entered failed state.
Mar 06 16:59:47 ubuntu systemd[1]: docker.service: Failed with result 'exit-code
root@ubuntu:~# journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished starting up.
-- 
-- The start-up result is done.
Mar 06 17:07:38 ubuntu 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.
Mar 06 17:07:38 ubuntu dockerd[9944]: time="2017-03-06T17:07:38.217987846+08:00"
Mar 06 17:07:39 ubuntu kernel: audit: type=1400 audit(1488791259.311:58): apparm
Mar 06 17:07:39 ubuntu audit[9980]: AVC apparmor="STATUS" operation="profile_rep
Mar 06 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.327277215+08:00"
Mar 06 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.330977072+08:00"
Mar 06 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.331639712+08:00"
Mar 06 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.332261285+08:00"
Mar 06 17:07:39 ubuntu dockerd[9944]: ........time="2017-03-06T17:07:39.34310685
Mar 06 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.365163611+08:00"
Mar 06 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.388542420+08:00"
Mar 06 17:07:39 ubuntu systemd[1]: docker.service: Main process exited, code=exi
Mar 06 17:07:39 ubuntu systemd[1]: Failed to start Docker Application Container 
-- 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.
Mar 06 17:07:39 ubuntu systemd[1]: docker.service: Unit entered failed state.
Mar 06 17:07:39 ubuntu systemd[1]: docker.service: Failed with result 'exit-code

通过查找系统日志:

root@ubuntu:/var/log# cd
root@ubuntu:~# cd /var/log
root@ubuntu:/var/log# ls
alternatives.log  dpkg.log         lastlog              vmware-vmsvc.log
apt               faillog          lightdm              wtmp
auth.log          fontconfig.log   speech-dispatcher    Xorg.0.log
bootstrap.log     fsck             syslog               Xorg.0.log.old
btmp              gpu-manager.log  syslog.1             yum.log
cups              hp               unattended-upgrades
dist-upgrade      installer        upstart
dmesg             kern.log         vmware
root@ubuntu:/var/log# cat syslog
//或者通过
root@ubuntu:/var/log# vim syslog

可以看到具体错误信息如下:

Mar  6 17:07:38 ubuntu dockerd[9944]: time="2017-03-06T17:07:38.217987846+08:00" level=info msg="libcontainerd: new containerd process, pid: 9960"
Mar  6 17:07:39 ubuntu kernel: [21284.569382] audit: type=1400 audit(1488791259.311:58): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="docker-default" pid=9980 comm="apparmor_parser"
Mar  6 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.327277215+08:00" level=info msg="[graphdriver] using prior storage driver \"aufs\""
Mar  6 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.330977072+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Mar  6 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.331639712+08:00" level=warning msg="Your kernel does not support swap memory limit."
Mar  6 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.332261285+08:00" level=info msg="Loading containers: start."
Mar  6 17:07:39 ubuntu dockerd[9944]: ........time="2017-03-06T17:07:39.343106854+08:00" level=info msg="Firewalld running: false"
//注意下面这段错误信息
Mar  6 17:07:39 ubuntu dockerd[9944]: time="2017-03-06T17:07:39.365163611+08:00" level=warning msg="could not create bridge network for id d6f9d6b857030363444f5dc8fcc8b131831f13b440fa317e10f82bf07e6a8f5d bridge name docker_new0 while booting up from persistent state: bridge device with non default name docker_new0 must be created manually"
Mar  6 17:07:39 ubuntu dockerd[9945]: time="2017-03-06T17:07:39.388542420+08:00" level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: bridge device with non default name docker_new0 must be created manually"
Mar  6 17:07:39 ubuntu systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Mar  6 17:07:39 ubuntu systemd[1]: Failed to start Docker Application Container Engine.
Mar  6 17:07:39 ubuntu systemd[1]: docker.service: Unit entered failed state.
Mar  6 17:07:39 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
~                                                                               

方法一:新建自定义网桥docker_new0

brctl addbr docker_new0

方法二:修改/etc/default/docker文件
这里写图片描述
修改成
这里写图片描述
这样再次登录使用的就是默认网桥docker0了。

再次执行docker启动命令正常:

sudo systemctl start docker

该问题报出的异常有如下这些:

//错误信息一
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
//错误信息二
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

作者:jiankunking 出处:http://blog.csdn.net/jiankunking

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页