Failed to allocate gateway with docker stack

Viewed 2064

I'm trying to execute the tutorial from the official documentation. It works fine except with Services.

When I start 5 instances of the container (with docker stack command), the containers are not starting and I get this error:

"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…"  
...

The docker-compose.yml contains

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:

to start containers I'm using the command:

$ docker stack deploy -c docker-compose.yml getstartedlab

I can start without any issue one instance of the container with the command:

$ docker run -p 80:80 seb/docker-whale:1.1

Any idea why it's not working? How can I get more details on the error? Thanks for your help.

1 Answers

Answer from a beginner: Same here (version 1.13.1), the message vanished when I changed ports "80:80" to "8080:80". Port 80 was used by the host of the docker machine.

Related