Docker Community Forums

Share and learn in the Docker community.

Docker Compose Replicas


(Bottledwind) #1

Trying to start a service with docker-compose.yml on a swarm but replicas always start with 0/5 workers.

How can I start a service with it deploying to all worker nodes???

version: "3"

services:

  worker:
    image: bottledwind/geekbench
    deploy:
      mode: replicated
      replicas: 5
      resources:
        # Hard limit - Docker does not allow to allocate more
        limits:
          cpus: '0.25'
          memory: 512M
        # Soft limit - Docker makes best effort to return to it
        reservations:
          cpus: '0.25'
          memory: 256M
      # service restart policy
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      # service update configuration
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: continue
        monitor: 60s
        max_failure_ratio: 0.3
      # placement constraint - in this case on 'worker' nodes only
      placement:
        constraints: [node.role == worker]