docker 部署 consul
单节点
- docker-compose.yml
version: '3.7' services: consul: image: consul # restart: always ports: - "8500:8500" command: "agent -server -client 0.0.0.0 -bootstrap -node consul1 -ui -bind 0.0.0.0"
多节点
- docker-compose.yml
version: '3.7' services: consul1: image: consul # restart: always ports: - "8500:8500" command: "agent -server -client 0.0.0.0 -bootstrap-expect 3 -node consul1 -ui -bind 0.0.0.0" consul2: image: consul # restart: always command: "agent -server -client 0.0.0.0 -retry-join=consul1 -node consul2 -bind 0.0.0.0" consul3: image: consul # restart: always command: "agent -server -client 0.0.0.0 -retry-join=consul1 -node consul3 -bind 0.0.0.0"