Docker 使用 Etcd 集群,报错

来源:4-10 Docker Overlay网络和etcd实现多机容器通信

慕移动0419469

2018-12-15

老师您好!
我在 启动 Docker 时报错

节点 1 的启动的命令

sudo  /usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-store=etcd://192.168.60.10:2379 --cluster-advertise=192.168.60.10:2375 &

之后在启动的过程中出现了 警告信息

INFO[2018-12-15T11:15:20.549930356Z] starting containerd                           revision=c4446665cb9c30056f4998ed953e6d4ff22c7c39 version=1.2.0
INFO[2018-12-15T11:15:20.550246198Z] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2018-12-15T11:15:20.551788734Z] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
WARN[2018-12-15T11:15:20.552015752Z] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
INFO[2018-12-15T11:15:20.552035433Z] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
WARN[2018-12-15T11:15:20.553769612Z] failed to load plugin io.containerd.snapshotter.v1.aufs  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found.\n": exit status 1"
INFO[2018-12-15T11:15:20.553797496Z] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2018-12-15T11:15:20.555515768Z] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2018-12-15T11:15:20.557163301Z] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
WARN[2018-12-15T11:15:20.557342766Z] failed to load plugin io.containerd.snapshotter.v1.zfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"
INFO[2018-12-15T11:15:20.557355343Z] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[2018-12-15T11:15:20.557373402Z] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
WARN[2018-12-15T11:15:20.557381287Z] could not use snapshotter aufs in metadata plugin  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found.\n": exit status 1"
WARN[2018-12-15T11:15:20.557389428Z] could not use snapshotter zfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"

...略...

WARN[2018-12-15T11:15:21.131721812Z] Failure during overlay endpoints restore: restore network sandbox failed: network sandbox join failed: could not get network sandbox (oper true): failed get network namespace "": no such file or directory
INFO[2018-12-15T11:15:21.200832337Z] 2018/12/15 11:15:21 [INFO] serf: EventMemberJoin: docker-node1 192.168.60.10

INFO[2018-12-15T11:15:21.378251125Z] Removing stale sandbox 400c8e731c87138ee879a21d61b10fca58a201366f149861306dd7e624cc8949 (893f203db170d842bab0b115d99d204b2f917a21097a11acc8a2e09736fe2dfb)
WARN[2018-12-15T11:15:21.404591464Z] Entry was not in db: nid:e7ca757c5de6873229b5664fb4648d61e01d3f2ee49fcd2410f69ed12460e244 eid:23373aaa211617f9297dda3eea4f96a2564fc5da555cbd4ff43d709ae3613a5d peerIP:10.0.0.2 peerMac:02:42:0a:00:00:02 isLocal:true vtep:192.168.60.10
WARN[2018-12-15T11:15:21.434568633Z] Error (Unable to complete atomic operation, key modified) deleting object [endpoint e7ca757c5de6873229b5664fb4648d61e01d3f2ee49fcd2410f69ed12460e244 23373aaa211617f9297dda3eea4f96a2564fc5da555cbd4ff43d709ae3613a5d], retrying....
WARN[2018-12-15T11:15:21.463271298Z] Failed deleting endpoint 930ebd87a1b0cb8a3d1d408d701337c480ff1f0450ca77f7eb2a0f15de7a80a0: failed to get endpoint from store during Delete: could not find endpoint 930ebd87a1b0cb8a3d1d408d701337c480ff1f0450ca77f7eb2a0f15de7a80a0: []

最后出现了一个错误信息

ERRO[2018-12-15T10:39:33.909791839Z] joining serf neighbor 192.168.60.20 failed: Failed to join the cluster at neigh IP 192.168.60.20: 1 error(s) occurred:

* Failed to join 192.168.60.20: dial tcp 192.168.60.20:7946: connect: connection refused

当我启动节点 2 的时候,在 节点 1 中出现了如下信息

INFO[2018-12-15T10:39:33.921927348Z] 2018/12/15 10:39:33 [INFO] serf: EventMemberJoin: docker-node2 192.168.60.20

在 节点 2 中启动 Docker 也出现了如下信息

INFO[2018-12-15T11:17:48.581136612Z] starting containerd                           revision=c4446665cb9c30056f4998ed953e6d4ff22c7c39 version=1.2.0
INFO[2018-12-15T11:17:48.581718472Z] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2018-12-15T11:17:48.583088580Z] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
WARN[2018-12-15T11:17:48.583373127Z] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
INFO[2018-12-15T11:17:48.583397823Z] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
WARN[2018-12-15T11:17:48.585754563Z] failed to load plugin io.containerd.snapshotter.v1.aufs  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found.\n": exit status 1"
INFO[2018-12-15T11:17:48.585783180Z] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2018-12-15T11:17:48.586785669Z] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2018-12-15T11:17:48.588453800Z] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
WARN[2018-12-15T11:17:48.588632918Z] failed to load plugin io.containerd.snapshotter.v1.zfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"
INFO[2018-12-15T11:17:48.588645731Z] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[2018-12-15T11:17:48.588664311Z] could not use snapshotter zfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"
WARN[2018-12-15T11:17:48.588672201Z] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
WARN[2018-12-15T11:17:48.588678399Z] could not use snapshotter aufs in metadata plugin  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found.\n": exit status 1"
...略...
INFO[2018-12-15T11:17:48.715815342Z] Loading containers: start.
WARN[2018-12-15T11:17:49.175799138Z] Failure during overlay endpoints restore: restore network sandbox failed: network sandbox join failed: could not get network sandbox (oper true): failed get network namespace "": no such file or directory
INFO[2018-12-15T11:17:49.420007271Z] Removing stale sandbox 365ee4072f0b67ead513086b77b6ac1647792b927264191faf852ac1598d5486 (a34a2eb2700aa8c952279a3083c8f6cf9d7bc49158ddf8f86cc6daf550c0e430)
WARN[2018-12-15T11:17:49.449204193Z] Entry was not in db: nid:e7ca757c5de6873229b5664fb4648d61e01d3f2ee49fcd2410f69ed12460e244 eid:963c917d027f69c48e2472427e3b1040448bec4396bee0bc4faca001fd839273 peerIP:10.0.0.3 peerMac:02:42:0a:00:00:03 isLocal:true vtep:<nil>
WARN[2018-12-15T11:17:49.487143822Z] Error (Unable to complete atomic operation, key modified) deleting object [endpoint e7ca757c5de6873229b5664fb4648d61e01d3f2ee49fcd2410f69ed12460e244 963c917d027f69c48e2472427e3b1040448bec4396bee0bc4faca001fd839273], retrying....
WARN[2018-12-15T11:17:49.523077612Z] Failed deleting endpoint 124a2a1ca17d48867d90c9422dde7fa658e998ae140ff26e30ea815fb7d9a02d: failed to get endpoint from store during Delete: could not find endpoint 124a2a1ca17d48867d90c9422dde7fa658e998ae140ff26e30ea815fb7d9a02d: []

启动节点 2 之后,我切换到 节点 1 , 发现了如下报错信息

INFO[2018-12-15T11:15:21.592614977Z] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
INFO[2018-12-15T11:15:21.698153109Z] Loading containers: done.
INFO[2018-12-15T11:15:21.804999352Z] Docker daemon                                 commit=4d60db4 graphdriver(s)=overlay2 version=18.09.0
INFO[2018-12-15T11:15:21.806575994Z] Daemon has completed initialization
INFO[2018-12-15T11:15:21.861495739Z] API listen on /var/run/docker.sock
INFO[2018-12-15T11:15:21.861595152Z] API listen on [::]:2375
ERRO[2018-12-15T11:17:49.246634285Z] joining serf neighbor 192.168.60.20 failed: Failed to join the cluster at neigh IP 192.168.60.20: 1 error(s) occurred:

* Failed to join 192.168.60.20: dial tcp 192.168.60.20:7946: connect: connection refused
INFO[2018-12-15T11:18:00.704583191Z] 2018/12/15 11:18:00 [INFO] serf: EventMemberJoin: docker-node2 192.168.60.20

我目前的状态下,无法正常运行容器在 overlay 网络上

[vagrant@docker-node2 ~]$ sudo docker run -itd --rm --name=redis --network=overlay_net redis:alpine
bbae06864eb2095b2ad2e40406087e459e33b0bd3c95f9fcba7ebc42de97cc08
ERRO[2018-12-15T11:22:48.114131750Z] bbae06864eb2095b2ad2e40406087e459e33b0bd3c95f9fcba7ebc42de97cc08 cleanup: failed to delete container from containerd: no such container
ERRO[2018-12-15T11:22:48.118928018Z] Handler for POST /v1.39/containers/bbae06864eb2095b2ad2e40406087e459e33b0bd3c95f9fcba7ebc42de97cc08/start returned error: network sandbox join failed: network sandbox join failed: could not get network sandbox (oper true): failed get network namespace "": no such file or directory
docker: Error response from daemon: network sandbox join failed: network sandbox join failed: could not get network sandbox (oper true): failed get network namespace "": no such file or directory.
写回答

3回答

麦兜搞IT

2018-12-17

您好,etcd的cluster建好了么 

./etcdctl cluster-health  这个命令的输出是什么

0
0

慕移动0419469

提问者

2018-12-15

[vagrant@docker-node1 ~]$ docker run -itd --name=redis-client --network=overlay_net python:3.6-alpine
a1addea588d697f3e4c9342e14f1298922613ec3a696fdd0074d778e0e4e2350
ERRO[2018-12-15T12:11:37.881457262Z] Failed to deserialize netlink ndmsg: invalid argument
INFO[2018-12-15T12:11:38.142732655Z] shim containerd-shim started                  address="/containerd-shim/moby/a1addea588d697f3e4c9342e14f1298922613ec3a696fdd0074d778e0e4e2350/shim.sock" debug=false pid=4058

目前我重启机器后,恢复集群的运行和 docker ,运行容器时出现了以上信息


0
0

慕移动0419469

提问者

2018-12-15

我把运行 docker 容器的参数 `--rm` 去掉后发现了如下报错信息


docker: Error response from daemon: network ovnet not found.

0
0

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程