无法使用令牌加入 Windows 中的 Docker 管理器节点
Cannot join Docker manager node in Windows using tokens
我和我的朋友正在尝试使用 Docker Swarm 连接我们的 Docker 守护进程。我们都在使用 Windows OS 并且我们不在同一个网络上。根据 Docker docs 每个 docker 主机必须打开以下端口;
TCP port 2377 for cluster management communications
TCP and UDP port 7946 for communication among nodes
UDP port 4789 for overlay network traffic
我们都在防火墙的入站和出站规则中为给定端口添加了新规则。尽管我们在尝试使用管理器节点使用 docker swarm join --token
命令创建的令牌加入时不断遇到相同的两个错误;
1. error response from daemon: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 192.168.65.3:2377: connect: connection refused"
2. Timeout error
此外,如果我们中的任何一个运行 docker swarm init
,它会显示 192.168.65.3
IP 地址不属于我们所连接的任何网络。这是什么意思?
Docker overlay tutorial 还指出,为了连接到管理器节点,工作节点应添加管理器的 IP 地址。
docker swarm join --token \ --advertise-addr IP-ADDRESS-OF-WORKER-1
IP-ADDRESS-OF-MANAGER:2377
这是否意味着在我们的例子中,我们必须在 启用端口转发后使用 public 管理器节点的 IP 地址 ?
撇开潜在的网络问题不谈,这是您的问题:
We both are using Windows OS
我在尝试在 multi-node 集群中使用 Windows 节点时在其他线程中看到了这个问题。以下是来自 Docker overlay networks documentation 的一些重要信息:
Before you can create an overlay network, you need to either initialize your Docker daemon as a swarm manager using docker swarm init
or join it to an existing swarm using docker swarm join
. Either of these creates the default ingress overlay network which is used by swarm services by default.
Overlay network encryption is not supported on Windows. If a Windows node attempts to connect to an encrypted overlay network, no error is detected but the node cannot communicate.
默认情况下,Docker 加密所有 swarm 服务管理流量。据我所知,禁用此加密是不可能的。不要将此与 --opt encrypted
选项混淆,因为这涉及加密应用程序数据,而不是集群管理流量。
对于single-node群,使用Windows就可以了。对于将使用 Docker 堆栈部署的 multi-node 群,我强烈建议对所有工作节点和管理器节点使用 Linux。
不久前,我使用 Linux 作为管理节点,使用 Windows 作为工作节点。我注意到只有 Linux 机器是 swarm 管理器时加入 swarm 才有效;如果 Windows 机器是管理器,加入 swarm 是行不通的。在 Windows 机器加入 swarm 后,container-to-container 通过 user-defined 覆盖网络的通信将无法正常工作。用 Linux 机器替换 Windows 机器解决了所有问题。
我和我的朋友正在尝试使用 Docker Swarm 连接我们的 Docker 守护进程。我们都在使用 Windows OS 并且我们不在同一个网络上。根据 Docker docs 每个 docker 主机必须打开以下端口;
TCP port 2377 for cluster management communications TCP and UDP port 7946 for communication among nodes UDP port 4789 for overlay network traffic
我们都在防火墙的入站和出站规则中为给定端口添加了新规则。尽管我们在尝试使用管理器节点使用 docker swarm join --token
命令创建的令牌加入时不断遇到相同的两个错误;
1. error response from daemon: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 192.168.65.3:2377: connect: connection refused"
2. Timeout error
此外,如果我们中的任何一个运行 docker swarm init
,它会显示 192.168.65.3
IP 地址不属于我们所连接的任何网络。这是什么意思?
Docker overlay tutorial 还指出,为了连接到管理器节点,工作节点应添加管理器的 IP 地址。
docker swarm join --token \ --advertise-addr IP-ADDRESS-OF-WORKER-1
IP-ADDRESS-OF-MANAGER:2377
这是否意味着在我们的例子中,我们必须在 启用端口转发后使用 public 管理器节点的 IP 地址 ?
撇开潜在的网络问题不谈,这是您的问题:
We both are using Windows OS
我在尝试在 multi-node 集群中使用 Windows 节点时在其他线程中看到了这个问题。以下是来自 Docker overlay networks documentation 的一些重要信息:
Before you can create an overlay network, you need to either initialize your Docker daemon as a swarm manager using
docker swarm init
or join it to an existing swarm usingdocker swarm join
. Either of these creates the default ingress overlay network which is used by swarm services by default.
Overlay network encryption is not supported on Windows. If a Windows node attempts to connect to an encrypted overlay network, no error is detected but the node cannot communicate.
默认情况下,Docker 加密所有 swarm 服务管理流量。据我所知,禁用此加密是不可能的。不要将此与 --opt encrypted
选项混淆,因为这涉及加密应用程序数据,而不是集群管理流量。
对于single-node群,使用Windows就可以了。对于将使用 Docker 堆栈部署的 multi-node 群,我强烈建议对所有工作节点和管理器节点使用 Linux。
不久前,我使用 Linux 作为管理节点,使用 Windows 作为工作节点。我注意到只有 Linux 机器是 swarm 管理器时加入 swarm 才有效;如果 Windows 机器是管理器,加入 swarm 是行不通的。在 Windows 机器加入 swarm 后,container-to-container 通过 user-defined 覆盖网络的通信将无法正常工作。用 Linux 机器替换 Windows 机器解决了所有问题。