dockerfile different services same mount code example

Example: --constraint node.labels. in compose file

zookeeper:
    image: sweh/test:fake_zookeeper
    deploy:
      replicas: 2
      placement:
        constraints: [node.labels.Zookeeper == true ]
    volumes:
      - "/myapp/zookeeper/data:/usr/zookeeper/data"
      - "/myapp/zookeeper/logs:/usr/zookeeper/logs"
      - "/myapp/zookeeper/conf:/usr/zookeeper/conf"
    environment:
      CFG_FILE: /usr/zookeeper/conf/zoo.cfg

  memcached:
    image: sweh/test:fake_memcached
    deploy:
      replicas: 1
      placement:
        constraints: [node.labels.Memcached == true ]

Tags:

Misc Example