我正在进行 Docker 入门指南:https://docs.docker.com/get-started/part3/#recap-and-cheat-sheet-optional
docker-compose.yml:
我通过运行命令
但是我无法通过在Chrome或Postman中访问
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:
我通过运行命令
docker stack deploy -c docker-compose.yml getstartedlab
部署了我的应用程序。然后用curl访问我的服务,正常工作:curl -4 http://localhost
。<h3>Hello World!</h3><b>Hostname:</b> 1532cae6e06f<br/>....
但是我无法通过在Chrome或Postman中访问
http://localhost:80
来访问它(它一直在加载)。为什么?我该如何解决?
更新19/10/17:
我可以从浏览器中访问我的服务:http://192.168.1.68:80
。
这是领导节点的地址(也是我的真实机器的IP地址..)。
但为什么我也不能从本地访问呢?