美文网首页
Docker部署单节点etcd

Docker部署单节点etcd

作者: 突击手平头哥 | 来源:发表于2021-08-21 21:24 被阅读0次

Docker部署单节点etcd

docker-compose.yml

version: "3.5"
services:
  etcd:
    hostname: etcd
    image: bitnami/etcd:3
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
    # ports:
    #   - "2379:2379"
    #   - "2380:2380"
    #   - "4001:4001"
    #   - "7001:7001"
    privileged: true
    volumes:
      - "/etcd/data:/opt/bitnami/etcd/data"
    environment:
      - "ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379"
      - "ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379"
      - "ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380"
      - "ETCD_INITIAL_ADVERTISE_PEER_URLS=http://0.0.0.0:2380"
      - "ALLOW_NONE_AUTHENTICATION=yes"
      - "ETCD_INITIAL_CLUSTER=node1=http://0.0.0.0:2380"
      - "ETCD_NAME=node1"
      - "ETCD_DATA_DIR=/opt/bitnami/etcd/data"
    ports:
      - 2379:2379
      - 2380:2380
    networks:
      - etcdnet

networks:
  etcdnet:
    name: etcdnet
  • 在任一目录下创建docker-compose.yml文件
  • 创建/etcd/data目录,用来映射目录存储etcd的数据
  • 访问2379端口即可

启动命令

docker-compose up

docker-compose.yml所在目录下执行即可,会在Docker创建容器后续就不需要这样来

相关文章

网友评论

      本文标题:Docker部署单节点etcd

      本文链接:https://www.haomeiwen.com/subject/fwjqiltx.html