一、拉去官方镜像
docker pull quay.io/coreos/etcd:v3.5.0
二、创建etcd容器
docker run -d \
-p 2379:2379 \
-p 2380:2380 \
--name etcd \
quay.io/coreos/etcd:v3.5.0 \
/usr/local/bin/etcd \
-advertise-client-urls http://0.0.0.0:2379 \
-listen-client-urls http://0.0.0.0:2379 \
-initial-advertise-peer-urls http://0.0.0.0:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster default=http://0.0.0.0:2380
注释:2379端口(用于客户端API)和2380端口(用于集群通信)映射到主机
三、简单使用:etcd CLI与etcd交互
# 获取etcd版本
docker exec etcd etcd --version
# 设置键值
docker exec etcd etcdctl put testkey hello
# 获取键值
docker exec etcd etcdctl get testkey
标签:http,0.0,2380,2379,etcd,docker,安装
From: https://www.cnblogs.com/qxlzzj/p/18101279