Answers: <p>I just figure it out. The problem is not with the service or the swarm, it's with the network.</p>
  
  <p>When I use <code>driver: overlay</code> the default <code>subnet</code> is <code>10.0.0.0/24</code> which result in 254 address. So I change the mask in the <code>subnet</code>, to 22, which result in 1022 address, I added:</p>
  
  <pre><code>ipam:
    config:
      -subnet: 10.0.0.0/22
  </code></pre>
  
  <p>And now the network section in the <code>docker-compose</code> file looks like this:</p>
  
  <pre><code>networks:
    web:
      driver: overlay
      ipam:
        config:
          - subnet: 10.0.0.0/22
  </code></pre>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-18T14:25:50.640Z
Answers: 2017-08-18T14:25:50.640Z
Answers: nirgn
Body: <p><strong>TLDR: Docker won't spin up more then 250 containers.</strong></p>
  
  <p>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 <code>replicas: 1</code> in the <code>docker-compose</code> file), and the third service need to have 300 containers (have a <code>replicas: 300</code> setting).</p>
  
  <p>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 <code>docker service ls</code>). I try to search if there is a limit of the service or swarm but couldn't find any.</p>
  
  <p>I will much appreciate any help I can get.</p>
  
  <ul>
  <li>If it's matter, each node with a 30GB RAM and 8 cores, and I use only 1/3 of the RAM.</li>
  </ul>
  
Tags: <docker><docker-compose><docker-swarm>
Title: Docker swarm stop spin up containers at 250
UserDisplayName: nirgn
ThreadText: # Docker swarm stop spin up containers at 250
  
  (Asked by: username_0 on 2017-08-18)
  
  **TLDR: Docker won't 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.
  
  * If it's matter, each node with a 30GB RAM and 8 cores, and I use only 1/3 of the RAM.
  
  **Tags:** docker, docker-compose, docker-swarm
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-08-18. Score: 5 | Accepted answer
  
  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
  
  ```
  
  
  ---
  
  