我正在尝试执行 tutorial from the official documentation .它工作正常,除了服务。
当我启动容器的 5 个实例时(使用 docker stack 命令),容器没有启动并且我收到此错误:
"failed to allocate gateway"
$ docker stack ps getstartedlab
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
imb6vgifjvq7 getstartedlab_web.1 seb/docker-whale:1.1 ns3553081.ip-XXX-YYY-ZZZ.eu Ready Rejected 4 seconds ago "failed to allocate gateway (1…"
ulm1tqdhzikd \_ getstartedlab_web.1 seb/docker-whale:1.1 ns3553081.ip-XXX-YYY-ZZZ.eu Shutdown Rejected 9 seconds ago "failed to allocate gateway (1…"
...
docker-compose.yml 包含
version: "3"
services:
web:
image: seb/docker-whale:1.1
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
我可以毫无问题地使用以下命令启动容器的一个实例:
$ docker run -p 80:80 seb/docker-whale:1.1
知道为什么它不起作用吗?如何获得有关错误的更多详细信息? 感谢您的帮助。
最佳答案
初学者的回答:同样在这里(版本 1.13.1),当我将端口“80:80”更改为“8080:80”时,消息消失了。 80端口被docker主机使用。
关于docker - 无法使用 docker 堆栈分配网关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44159248/