1

dokcer.service 提示缺失bridge网络,导致Cannot connect to the Docker daemon at un...

 1 year ago
source link: https://cloudsjhan.github.io/2019/06/04/dokcer-service-%E6%8F%90%E7%A4%BA%E7%BC%BA%E5%A4%B1bridge%E7%BD%91%E7%BB%9C%EF%BC%8C%E5%AF%BC%E8%87%B4Cannot-connect-to-the-Docker-daemon-at-unix-var-run-docker-sock-Is-the-docker-daemon-running/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

dokcer.service 提示缺失bridge网络,导致Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

发表于 2019-06-04

| 分类于 docker

| 阅读次数:

| 字数统计: 252

|

阅读时长 ≈ 1

dokcer.service 提示缺失bridge网络,导致Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

操作过程:

  1. 为CentOS7安装Docker,安装成功后,可以执行docker,但是docker ps等命令会报错:

  2. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

一般这种错误都是由于操作者没有root权限,但是使用sudo执行也是同样的问题,这就纳闷了,没关系,看一下docker.service的执行日志:

systemctl status docker.service

发现有一句很重要的话:

Error starting daemon: Error initializing network controller: list bridge addresses failed: no available network

这是由于启动Docker的时候,默认的网络模式是桥接模式,这就需要向操作系统发送信号,让它帮我们建立一个bridge网络命名为docker0, 并且分配172.17.0.1/16。但是出于某种原因,该网络没有建立起来,我们只要手动执行这一系列操作就可以:

ip link add name docker0 type bridge

ip addr add dev docker0 172.17.0.1/16

最后重启docker:

systemclt restart docker

-------------The End-------------
坚持原创技术分享,您的支持将鼓励我继续创作!
(>给这篇博客打个分吧<)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK