我是否需要为 docker 集群模式明确创建网络

Do I need to create a network explicitly for docker swarm mode

我一直在努力理解docker,群mode.I也阅读了docker网络教程。 我已经尝试了 docker swarm mode.If 初始化了 docker swarm 模式,如果我们执行 docker network ls 它会显示一个名为 ingress 的网络。 我的问题是我是否需要专门创建一个覆盖网络?或者游泳模式是否应该在不专门创建网络的情况下正常工作?

如果您需要在不同 Docker Swarm 节点上的容器之间进行通信,则需要覆盖网络。

如果你只是使用 "docker run" 它将使用主机上的入口网络你是 运行 命令。

My question is do I need to exclusively create an overlay network?Or should the swam mode work fine without exclusively creating a network?

不,您不需要,但是建议您为部署到 swarm 的应用程序创建自定义覆盖网络。 ingress 覆盖网络 handles control and data traffic related to swarm services。来自 official documentation:

Use the default overlay network demonstrates how to use the default overlay network that Docker sets up for you automatically when you initialize or join a swarm. This network is not the best choice for production systems.