docker swarm创建consul集群

原创
2018/08/14 14:55
阅读数 2.8K
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]

展开阅读全文
加载中
点击加入讨论🔥(2) 发布并加入讨论🔥
打赏
2 评论
0 收藏
0
分享
返回顶部
顶部