39 lines
		
	
	
		
			856 B
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			856 B
		
	
	
	
		
			YAML
		
	
	
	
| version: '3.8'
 | |
| 
 | |
| services:
 | |
|   consul:
 | |
|     image: consul:latest
 | |
|     hostname: consul
 | |
|     command: >
 | |
|       consul agent -server -bootstrap-expect=1
 | |
|       -datacenter=dc1 -data-dir=/consul/data
 | |
|       -node=consul -client=0.0.0.0
 | |
|       -ui
 | |
|       -log-level=INFO      
 | |
|     ports:
 | |
|       - "8500:8500"
 | |
|       - "8600:8600/udp"
 | |
|     volumes:
 | |
|       - consul_data:/consul/data
 | |
|     networks:
 | |
|       - consul-net
 | |
|     deploy:
 | |
|       mode: replicated
 | |
|       replicas: 1
 | |
|       restart_policy:
 | |
|         condition: on-failure
 | |
|         delay: 5s
 | |
|         max_attempts: 3
 | |
|       labels:
 | |
|         - "traefik.enable=true"
 | |
|         - "traefik.http.routers.consul.rule=Host(`consul.local`)"
 | |
|         - "traefik.http.services.consul.loadbalancer.server.port=8500"
 | |
|         - "traefik.docker.network=consul-net"
 | |
| 
 | |
| volumes:
 | |
|   consul_data:
 | |
| 
 | |
| networks:
 | |
|   consul-net:
 | |
|     driver: overlay
 | |
|     attachable: true |