本文介绍了如何在Docker第3部分教程中使用curl -4 http://localhost?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using the Docker tutorial I'm stuck at this part: https://docs.docker.com/get-started/part3/#run-your-new-load-balanced-app

我使用curl -4 http://localhost,但出现curl: (7) Failed to connect to localhost port 80: Connection refused错误.

输出: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 

所以errorports为空.

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

What should I analyse to fix this issue?

推荐答案

对于第4部分,当部署到集群时,您将获得带有docker-machine ls的URL.

For part 4 when you deploy to your swarm, you get an URL with docker-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更改为4000:80

Change in docker-compose.yml file 80:80 to 4000:80

使用192.168.99.100:4000,它应该可以正常工作.

Use 192.168.99.100:4000 and it should be working.

这篇关于如何在Docker第3部分教程中使用curl -4 http://localhost?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:48