version: '3.6' services: haproxy: image: {{ haproxy_docker_image }} configs: - source: haproxy-config target: /usr/local/etc/haproxy/haproxy.cfg networks: - {{ haproxy_docker_overlay_network }} volumes: #- /etc/haproxy:/usr/local/etc/haproxy:ro - /var/run/docker.sock:/var/run/docker.sock ports: - target: {{ haproxy_default_port }} published: {{ haproxy_default_port }} protocol: tcp mode: host - target: {{ haproxy_ssl_port }} published: {{ haproxy_ssl_port }} protocol: tcp mode: host - target: {{ haproxy_admin_port }} published: {{ haproxy_admin_port }} protocol: tcp mode: host dns: [127.0.0.11] deploy: mode: replicated replicas: 1 update_config: parallelism: 1 delay: 20s placement: constraints: - "node.role==manager" restart_policy: condition: {{ haproxy_docker_restart_policy}} delay: 20s max_attempts: 5 window: 120s resources: limits: cpus: '2.0' memory: 768M reservations: cpus: '1.0' memory: 384M logging: driver: 'journald' configs: haproxy-config: file: ./haproxy.cfg networks: {{ haproxy_docker_overlay_network }}: external: true