在 Ubuntu 14.04 中为 docker 禁用 ipv6

Disable ipv6 for docker in Ubuntu 14.04

我在 Ubuntu 14.04 VM 上安装的 docker 守护进程有问题。日志显示 ipv6 已启用,因此 docker 似乎正在侦听此 ip 地址。本质上,这会影响 Clair. I have made sure that ipv6 is disabled on the following recommendation here. I also disabled ipv6 in daemon.json as specified in Docker documentation。我的 docker 版本是 Docker version 17.06.1-ce, build 874a737

Docker 守护程序日志:

time="2018-02-20T20:33:17.736203462+01:00" level=info msg="IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 20 01:4860:4860::8844]"

克莱尔日志:

2018/02/20 20:43:51 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp [::]:6060: connect: cannot assign requested address"; Reconnecting to {[::]:6060 <nil>} 2018/02/20 20:46:14 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp [::]:6060: connect: cannot assign requested address"; Reconnecting to {[::]:6060 <nil>}

正在尝试建立 IPv6 连接,但地址错误。 [::] 是 IN6ADDR_ANY,不是您可以连接到的实际地址。在 config.yaml.

中提供正确的地址

您是要连接到本地主机吗?

api:
  # v3 grpc/RESTful API server address
  addr: "[::1]:6060"