端口不会在swarm master中使用“docker stack deploy”发布

有两个节点(一个主站和一个从站)。

在swarm master中执行docker stack deploy -c compose.yml nginx ,我可以看到这个nginx实例正在slave( docker ps )中运行。

当我在master和slave上执行curl -XGET localhost:9999时,我在swarm master中得到超时 ,但是在swarm slave上得到了结果(index.html)。 为什么是这样?

compose.yml

 version: '3' services: nginx: image: 10.31.207.156:5000/nginx ports: - 9999:80 

dockerfile

 FROM registry.docker-cn.com/library/nginx COPY . /usr/share/nginx/html 

的index.html

 <!DOCTYPE html> <html> <head> </head> <body> <div>Hello World</div> </body> </html> 

顺便说一句,我在CentOS 7.3上运行docker