Docker swarm 容器副本是 运行 但无法在浏览器中或使用 curl 访问相同的副本
Docker swarm container replicas are running but not able to hit the same in browser or with curl
正在关注 docker 文档并尝试使用 link --> https://docs.docker.com/get-started/part3/
创建节点副本
我已按照文档中提到的步骤进行操作,但无法在 curl 或浏览器上获得预期的应用程序响应。
docker 分解文件如下所示:
version: "3"
services:
web:
image: vigneshnithin23/restaurant:latest
deploy:
replicas: 2
placement:
constraints: [node.role == manager]
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "8090:8090"
networks:
- webnet
networks:
webnet:
根据文档,他们能够卷曲 URL。而我无法做同样的事情。
我有两个 IP 地址并使用 --advertise-addr 初始化 docker swarm - 第一个 wlan 地址
如果我 运行 在单个容器上使用相同的代码,我就能得到想要的结果。
我查看了下面 link 中的问题,之前有人问过这个问题,但没有正确的答案
Website available in standalone container, not in swarm
如有任何帮助,我们将不胜感激。
You need to ask yourself whether your SpringBoot app would be able to
run in that constrained environment of 50% usage of the CPU per second
and 50M.
当您运行将其作为单个容器[启动时间为 9 毫秒]时,它 运行 在不受约束的环境中运行,而在您的堆栈文件中却对其进行了限制。因此,当您启动服务时,需要更长的时间来预热和启动。
这是同一个应用程序的屏幕截图,只需将副本集更改为“1”并将内存增加到 100M,服务应用程序和服务响应大约需要 900 毫秒。
因此请尝试针对资源限制微调这些设置。
正在关注 docker 文档并尝试使用 link --> https://docs.docker.com/get-started/part3/
创建节点副本我已按照文档中提到的步骤进行操作,但无法在 curl 或浏览器上获得预期的应用程序响应。
docker 分解文件如下所示:
version: "3"
services:
web:
image: vigneshnithin23/restaurant:latest
deploy:
replicas: 2
placement:
constraints: [node.role == manager]
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "8090:8090"
networks:
- webnet
networks:
webnet:
根据文档,他们能够卷曲 URL。而我无法做同样的事情。
我有两个 IP 地址并使用 --advertise-addr 初始化 docker swarm - 第一个 wlan 地址
如果我 运行 在单个容器上使用相同的代码,我就能得到想要的结果。
我查看了下面 link 中的问题,之前有人问过这个问题,但没有正确的答案
Website available in standalone container, not in swarm
如有任何帮助,我们将不胜感激。
You need to ask yourself whether your SpringBoot app would be able to run in that constrained environment of 50% usage of the CPU per second and 50M.
当您运行将其作为单个容器[启动时间为 9 毫秒]时,它 运行 在不受约束的环境中运行,而在您的堆栈文件中却对其进行了限制。因此,当您启动服务时,需要更长的时间来预热和启动。
这是同一个应用程序的屏幕截图,只需将副本集更改为“1”并将内存增加到 100M,服务应用程序和服务响应大约需要 900 毫秒。
因此请尝试针对资源限制微调这些设置。