我正在做码头工具入门指南:https://docs.docker.com/get-started/part3/#recap-and-cheat-sheet-optional
泊坞窗,compose.yml:
version: "3"
services:
web:
# replace username/repo:tag with your name and image details
image: username/repo:tag
deploy:
replicas: 5
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:
Run Code Online (Sandbox Code Playgroud)
我通过运行部署我的应用程序docker stack deploy -c docker-compose.yml getstartedlab.然后从curl访问我的服务工作正常curl -4 http://localhost
<h3>Hello World!</h3><b>Hostname:</b> 1532cae6e06f<br/>....
Run Code Online (Sandbox Code Playgroud)
但我无法通过转到http://localhost:80(它永远加载)从chrome或邮递员访问它.为什么以及如何解决它?
我可以在浏览器中访问我的服务:http://192.168.1.68:80.它是领导节点的地址(也是我真机的IP).
但是为什么我不能从localhost那里做呢?
BMi*_*tch 13
看到这curl -4 ...让我怀疑这是一个ipv6问题.如果没有为ipv6配置本地计算机,并且localhost在hosts文件中引用了ipv6地址,则对localhost的调用将挂起.
解决方法相当简单,127.0.0.1而不是localhost在您的网址中.
| 归档时间: |
|
| 查看次数: |
2057 次 |
| 最近记录: |