version: "3.7" #docker network create -d overlay --attachable client-net networks: client-net: external: true volumes: consul-data: services: consul: image: consul:1.4.0 # will be used as consul node name (alphanum and dash only) hostname: "{{.Node.Hostname}}" # ports: # - target: 8500 # published: 8500 # mode: host command: "agent -server -retry-join consul.server -ui -client 0.0.0.0" environment: - CONSUL_BIND_INTERFACE=eth0 - 'CONSUL_LOCAL_CONFIG={ "datacenter":"client", "leave_on_terminate": true, "skip_leave_on_interrupt": true, "autopilot": { "cleanup_dead_servers": true }, "bootstrap_expect": 2, "disable_update_check": true, "disable_host_node_id": true }' networks: client-net: aliases: - consul.server deploy: mode: global endpoint_mode: dnsrr update_config: parallelism: 1 failure_action: rollback delay: 30s restart_policy: condition: any delay: 5s window: 120s volumes: - consul-data:/consul/data labels: - "SERVICE_IGNORE=yes"