Docker 安裝 consul
version: '2'
networks:
byfn:
services:
consul-server-1:
image: consul
container_name: node1
command: agent -server -bootstrap-expect=3 -node=consul-server-1 -bind=0.0.0.0 -client=0.0.0.0 -datacenter=dc1
restart: always
networks:
- byfn
consul-server-2:
image: consul
container_name: node2
command: agent -server -retry-join=node1 -node=consul-server-2 -bind=0.0.0.0 -client=0.0.0.0 -datacenter=dc1
restart: always
depends_on:
- consul-server-1
networks:
- byfn
consul-server-3:
image: consul
container_name: node3
command: agent -server -retry-join=node1 -node=consul-server-3 -bind=0.0.0.0 -client=0.0.0.0 -datacenter=dc1
restart: always
depends_on:
- consul-server-1
networks:
- byfn
consul-client-1:
image: consul
container_name: node4
command: agent -retry-join=node1 -node=consul-client-1 -bind=0.0.0.0 -client=0.0.0.0 -datacenter=dc1 -ui
restart: always
ports:
- 8500:8500
depends_on:
- consul-server-2
- consul-server-3
networks:
- byfn