swarm集群 - 当Docker Swarm discovery 为file时,应该怎么创建集群

【字号: 日期:2023-02-17浏览:34作者:雯心

问题描述

manage:192.168.5.5

node:192.168.5.3 、 192.168.5.4

Docker Swarm discovery 为 file://path/to/file

cluster文件内容:

192.168.5.3:2375192.168.5.4:2375

manage(192.168.5.5) command:docker run -d -it -h node-m --name=node-m --restart=always -v $(pwd)/cluster:/tmp/cluster -p 3375:3375 swarm manage -H 0.0.0.0:3375 file:///tmp/cluster

node1(192.168.5.3) command:docker run -d -it -h node-1 --name=node-1 -v $(pwd)/cluster:/tmp/cluster swarm join --addr=192.168.5.3:2375 file:///tmp/cluster

node2(92.168.5.4) command:docker run -d -it -h node-2 --name=node-2 -v $(pwd)/cluster:/tmp/cluster swarm join --addr=192.168.5.4:2375 file:///tmp/cluster

manage(192.168.5.5) command:

[root@manage opt]# docker run --rm -v $(pwd)/cluster:/tmp/cluster swarm list file:///tmp/cluster 192.168.5.3:2375192.168.5.4:2375[root@manage opt]# docker -H 0.0.0.0:3375 infoContainers: 0 Running: 0 Paused: 0 Stopped: 0Images: 0Server Version: swarm/1.2.6Role: primaryStrategy: spreadFilters: health, port, containerslots, dependency, affinity, constraint, whitelistNodes: 2 (unknown): 192.168.5.3:2375 └ ID: └ Status: Pending └ Containers: 0 └ Reserved CPUs: 0 / 0 └ Reserved Memory: 0 B / 0 B └ Labels: └ Error: Cannot connect to the Docker daemon at tcp://192.168.5.3:2375. Is the docker daemon running? └ UpdatedAt: 2017-04-10T19:03:37Z └ ServerVersion: (unknown): 192.168.5.4:2375 └ ID: └ Status: Pending └ Containers: 0 └ Reserved CPUs: 0 / 0 └ Reserved Memory: 0 B / 0 B └ Labels: └ Error: Cannot connect to the Docker daemon at tcp://192.168.5.4:2375. Is the docker daemon running? └ UpdatedAt: 2017-04-10T19:03:37Z └ ServerVersion: Plugins: Volume: Network: Swarm: NodeID: Is Manager: false Node Address: Security Options:Kernel Version: 3.10.0-514.el7.x86_64Operating System: linuxArchitecture: amd64Number of Docker Hooks: 2CPUs: 0Total Memory: 0 BName: node-mDocker Root Dir: Debug Mode (client): falseDebug Mode (server): falseWARNING: No kernel memory limit supportRegistries:

manage、node1、node2 ps -a命令结果

[root@manage opt]# docker ps -aCONTAINER IDIMAGE COMMAND CREATED STATUS PORTS NAMES18a246b46399swarm '/swarm manage -H 0.0' 3 minutes ago Up 3 minutes2375/tcp, 0.0.0.0:3375->3375/tcp node-m[root@node1 opt]# docker ps -aCONTAINER IDIMAGE COMMAND CREATED STATUS PORTS NAMESdf43c2cbfee0swarm '/swarm join --addr=1' 2 minutes ago Up 2 minutes2375/tcp node-1[root@node2 opt]# docker ps -aCONTAINER IDIMAGE COMMAND CREATED STATUS PORTS NAMESa9b48c6d7be2swarm '/swarm join --addr=1' 3 minutes ago Up 3 minutes2375/tcp node-2

其他信息:

swarm version: 1.2.6

docker version: 1.12.6

为什么会出现这样的问题呢'Cannot connect to the Docker daemon at tcp://192.168.5.x:2375. Is the docker daemon running?'

问题解答

回答1:

你还是用的老版的?

使用docker 1.12 搭建多主机docker swarm集群

docker 1.12 的服务自动发现

相关文章: