Docker-带Docker工具箱的swarm';跑不动
我应用docker教程来建立swarm。 我使用了docker工具箱,因为我使用的是windows 10系列 我对所有语句进行单步处理,但在最后,“curlip_address”语句没有运行。访问url时也出现错误Docker-带Docker工具箱的swarm';跑不动,docker,Docker,我应用docker教程来建立swarm。 我使用了docker工具箱,因为我使用的是windows 10系列 我对所有语句进行单步处理,但在最后,“curlip_address”语句没有运行。访问url时也出现错误 $ docker --version Docker version 18.03.0-ce, build 0520e24302 docker-compose.yml,位于名为“myvm1”的虚拟机的/home/docker中: 蜂群: $ docker-machine ssh myv
$ docker --version
Docker version 18.03.0-ce, build 0520e24302
docker-compose.yml,位于名为“myvm1”的虚拟机的/home/docker中:
蜂群:
$ docker-machine ssh myvm1 "docker stack ps getstartedlab"
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
blmx8mldam52 getstartedlab_web.1 12081981/friendlyhello:part1 myvm1 Running Running 9 seconds ago
04ctl86chp6o getstartedlab_web.2 12081981/friendlyhello:part1 myvm3 Running Running 6 seconds ago
r3qyznllno9j getstartedlab_web.3 12081981/friendlyhello:part1 myvm3 Running Running 6 seconds ago
2twwicjssie9 getstartedlab_web.4 12081981/friendlyhello:part1 myvm1 Running Running 9 seconds ago
o4rk4x7bb3vm getstartedlab_web.5 12081981/friendlyhello:part1 myvm3 Running Running 6 seconds ago
“docker机器ls”的结果:
卷曲试验
$ curl 192.168.99.102
curl: (7) Failed to connect to 192.168.99.102 port 80: Connection refused
如何进行调试
如果你愿意,我可以提供更多的信息
提前感谢。在Windows中使用布线网格现在似乎是一项仅适用于EE的功能。您可以监视更多详细信息。当前的解决方法是在内部使用DNSRR,直接将端口发布到主机,而不是使用路由网格。如果您希望从群集中的任何节点都可以访问应用程序,这意味着您需要在群集中的任何主机上都有一个服务,该服务是全局调度的,侦听请求的端口。例如
version: "3.2"
services:
web:
# replace username/repo:tag with your name and image details
image: 12081981/friendlyhello:part1
deploy:
# global runs 1 on every node, instead of the replicated variant
mode: global
# DNSRR skips the VIP normally assigned to services
endpoint_mode: dnsrr
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- target: 80
published: 80
protocol: tcp
# host publishes the port directly from the container without the routing mesh
mode: host
networks:
- webnet
networks:
webnet:
您的服务是如何定义的?您是否发布了一个端口,并且应用程序正在侦听端口?我将添加到原始消息中,docker-compose.ymlI的内容添加到原始消息中,docker-compose.yml的内容现在添加到原始消息中。我在端口80上发布,在端口80上侦听应用程序。添加docker run-it--rm--net container:$container\u id nicolaka/netshoot ss-lnt的输出,其中$container\u id来自您的一个容器。它会提取图像,最后:
C:\Program Files\Docker Toolbox\Docker.exe:守护程序的错误响应:OCI运行时创建失败:容器\u linux。go:348:启动容器进程导致“exec:\“ss lnt\”:在$PATH中找不到可执行文件:未知。
非常感谢。它跑了!我拆掉了应用程序和swarm,使用了你的新docker-compose.ymldocker机器ssh myvm1“curl ip_address”
:使用192.168.99.102、192.168.99.103、localhost可以。有了web浏览器,它就可以了,但对用户来说不是。对于教程“container”,它运行于192.168.99.102,而不是localhost。我想知道为什么与localhostLocalhost一起运行的curl命令可能与ssh一起工作,否则您的vm与localhost不同。非常感谢。我读了你们引用的那个期。我将继续docker教程。我希望我没有其他问题,由docker工具箱版本引起。我没有找到5个实例(subtitute“replica”选项)。您有什么想法吗?从上面文件中的注释可以看出:“全局在每个节点上运行1,而不是复制的变量”
$ curl 192.168.99.102
curl: (7) Failed to connect to 192.168.99.102 port 80: Connection refused
version: "3.2"
services:
web:
# replace username/repo:tag with your name and image details
image: 12081981/friendlyhello:part1
deploy:
# global runs 1 on every node, instead of the replicated variant
mode: global
# DNSRR skips the VIP normally assigned to services
endpoint_mode: dnsrr
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- target: 80
published: 80
protocol: tcp
# host publishes the port directly from the container without the routing mesh
mode: host
networks:
- webnet
networks:
webnet: