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: - "./data:/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=./data" ports: - 2379:2379 - 2380:2380 networks: - etcdnet networks: etcdnet: name: etcdnet
在当前目录创建data目录
启动etcd服务
docker-compose up -d
查看服务状态
docker ps
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/282338.html