nirgn
nirgn

Reputation: 2074

Docker swarm stop spin up containers at 250

TLDR: Docker wont spin up more then 250 containers.

I'm deploying a cluster of 3 docker services to a swarm with 2 nodes. 2 of the services need to contain 1 container (have a replicas: 1 in the docker-compose file), and the third service need to have 300 containers (have a replicas: 300 setting).

The problem is it's spin up those 3 services, the first two with 1 container each (work like they should), and the third service spin up 248 containers out of 300 (I see this when I do docker service ls). I try to search if there is a limit of the service or swarm but couldn't find any.

I will much appreciate any help I can get.

Upvotes: 2

Views: 307

Answers (2)

nirgn
nirgn

Reputation: 2074

I just figure it out. The problem is not with the service or the swarm, it's with the network.

When I use driver: overlay the default subnet is 10.0.0.0/24 which result in 254 address. So I change the mask in the subnet, to 22, which result in 1022 address, I added:

ipam:
  config:
    -subnet: 10.0.0.0/22

And now the network section in the docker-compose file looks like this:

networks:
  web:
    driver: overlay
    ipam:
      config:
        - subnet: 10.0.0.0/22

Upvotes: 1

omu_negru
omu_negru

Reputation: 4770

I don't think you can spin up more than 250 for one service, due to the fact that all of them sitting on the same network would basically mean using up 250+ ip addresses. Unless you define a custom ipv6 network and try that, you're better off adding an extra network to your swarm, then spin a new identical service on that swarm but on the other network

TL; DR;

Define 2 networks and add them all to the service, then see if you can spin up more than 250 replicas

Upvotes: 0

Related Questions