Skip to content

Instantly share code, notes, and snippets.

@jmaitrehenry
Created April 3, 2018 16:54
Show Gist options
  • Save jmaitrehenry/40d8272f622a45ecca53cefa16362fb5 to your computer and use it in GitHub Desktop.
Save jmaitrehenry/40d8272f622a45ecca53cefa16362fb5 to your computer and use it in GitHub Desktop.
version: "3"
services:
consul1:
image: consul
command: agent -server -bootstrap-expect=3
environment:
- CONSUL_BIND_INTERFACE=eth0
- CONSUL_CLIENT_INTERFACE=eth0
volumes:
- consul-data1:/consul/data
deploy:
replicas: 1
placement:
constraints:
- node.hostname == vm-docker0
restart_policy:
condition: on-failure
networks:
- consul
consul2:
image: consul
command: agent -server -join consul1
environment:
- CONSUL_BIND_INTERFACE=eth0
- CONSUL_CLIENT_INTERFACE=eth0
volumes:
- consul-data2:/consul/data
deploy:
replicas: 1
placement:
constraints:
- node.hostname == vm-docker1
restart_policy:
condition: on-failure
networks:
- consul
depends_on:
- consul1
consul3:
image: consul
command: agent -server -join consul1
environment:
- CONSUL_BIND_INTERFACE=eth0
- CONSUL_CLIENT_INTERFACE=eth0
volumes:
- consul-data3:/consul/data
deploy:
replicas: 1
placement:
constraints:
- node.hostname == vm-docker2
restart_policy:
condition: on-failure
depends_on:
- consul1
networks:
- consul
networks:
consul:
driver: overlay
volumes:
consul-data1:
consul-data2:
consul-data3:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment