version: "3.5"
services:
  web:
    healthcheck:
      test: cat /etc/passwd
      interval: 10s
      timeout: 1s
      retries: 5
    deploy:
      mode: replicated
      replicas: 6
      labels: [FOO=BAR]
      update_config:
        parallelism: 3
        delay: 10s
        failure_action: continue
        monitor: 60s
        max_failure_ratio: 0.3
      resources:
        limits:
          cpus: 0.05
          memory: 50M
        reservations:
          cpus: 0.01
          memory: 20M
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      placement:
        constraints:
          - node.hostname==foo
          - node.role != manager
        preferences:
          - spread: node.labels.datacenter
    image: busybox
    volumes:
      - source: /host/path
        target: /container/path
        type: bind
        read_only: true
      - source: foobar
        target: /container/volumepath
        type: volume
      - target: /anonymous
        type: volume
      - source: foobar
        target: /container/volumepath2
        type: volume
        volume:
          nocopy: true
    stop_grace_period: 20s
volumes:
  foobar:
    labels:
      com.docker.compose.test: 'true'
