如何在 Docker 第 3 部分教程中使用curl -4 http://localhost?

2024-01-10

使用 Docker 教程我被困在这部分:https://docs.docker.com/get-started/part3/#run-your-new-load-balanced-app https://docs.docker.com/get-started/part3/#run-your-new-load-balanced-app

I use curl -4 http://localhost但我得到了curl: (7) Failed to connect to localhost port 80: Connection refused error.

上一步的输出:docker service ps getstartedlab_web

ID                  NAME                  IMAGE                      NODE                DESIRED STATE       CURRENT STATE            ERROR               PORTS
kqu5qggifnlm        getstartedlab_web.1   s1mpl3/get-started:part2   moby                Running             Running 29 minutes ago                       
prhrmm6hpop3        getstartedlab_web.2   s1mpl3/get-started:part2   moby                Running             Running 29 minutes ago                       
ytrwy5gxp2rk        getstartedlab_web.3   s1mpl3/get-started:part2   moby                Running             Running 29 minutes ago                       
mayvauijghbj        getstartedlab_web.4   s1mpl3/get-started:part2   moby                Running             Running 29 minutes ago                       
r625x2k7n6ta        getstartedlab_web.5   s1mpl3/get-started:part2   moby                Running             Running 29 minutes ago 

So error and ports是空的。

我应该分析什么来解决这个问题?


对于第 4 部分,当您部署到 swarm 时,您将获得一个 URLdocker-machine ls.

NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
myvm1   *        virtualbox   Running   tcp://192.168.99.100:2376           v17.10.0-ce   
myvm2   -        virtualbox   Running   tcp://192.168.99.101:2376           v17.10.0-ce 

docker-compose.yml 文件中的更改80:80 to 4000:80

Use 192.168.99.100:4000它应该可以工作。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Docker 第 3 部分教程中使用curl -4 http://localhost? 的相关文章

随机推荐