41 lines
850 B
YAML
41 lines
850 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
consul:
|
|
image: consul:latest
|
|
hostname: consul-ash3c
|
|
command: >
|
|
sh -c "
|
|
IP=$$(hostname -i | awk '{print $$1}');
|
|
consul agent -server -bootstrap-expect=2
|
|
-datacenter=dc1 -data-dir=/consul/data
|
|
-node=consul-ash3c -bind=$$IP -advertise=100.116.80.94 -client=0.0.0.0
|
|
-retry-join=100.117.106.136
|
|
-ui
|
|
-log-level=INFO
|
|
"
|
|
ports:
|
|
- "8500:8500"
|
|
- "8600:8600/udp"
|
|
volumes:
|
|
- consul_data:/consul/data
|
|
networks:
|
|
- consul-net
|
|
deploy:
|
|
mode: replicated
|
|
replicas: 1
|
|
placement:
|
|
constraints:
|
|
- node.hostname == ash3c
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
|
|
volumes:
|
|
consul_data:
|
|
|
|
networks:
|
|
consul-net:
|
|
driver: overlay
|
|
attachable: true |