您的位置:首页 > 运维架构 > Docker

docker swarm创建consul集群

2018-08-14 14:55 911 查看
version: '3.6'

x-consul: &consul
image: consul:latest
volumes:
- consul:/consul

volumes:
consul:

services:
client:
<<: *consul
ports:
- "8500:8500"
command: "agent -retry-join server-bootstrap -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}' -ui"
depends_on:
- server-bootstrap
deploy:
replicas: 2

server:
<<: *consul
depends_on:
- server-bootstrap
command: "agent -server -retry-join server-bootstrap -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}'"
deploy:
replicas: 2
placement:
constraints: [node.role == manager]

server-bootstrap:
image: consul
command: "agent -server -bootstrap-expect 3 -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}'"
deploy:
placement:
constraints: [node.role == manager]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息