Skip to content

Instantly share code, notes, and snippets.

@guoyoujin
Created January 8, 2018 08:25
Show Gist options
  • Save guoyoujin/b73e7f50c2edb684803e748ff9cefad5 to your computer and use it in GitHub Desktop.
Save guoyoujin/b73e7f50c2edb684803e748ff9cefad5 to your computer and use it in GitHub Desktop.
docker-etcd-compose.yml
version: '2'
services:
etcd1:
image: quay.io/coreos/etcd:v3.2.5
restart: always
ports:
- 23791:2379
- 23801:2380
volumes:
- ./certs/:/srv/
- /srv/docker/etcd:/etcd-data
environment:
ETCD_NAME: node1
ETCD_DATA_DIR: /etcd-data/etcd1.etcd
ETCDCTL_API: 3
ETCD_DEBUG: 1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd1:2380
ETCD_INITIAL_CLUSTER: node3=http://etcd3:2380,node1=http://etcd1:2380,node2=http://etcd2:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: etcd-ftw
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_ADVERTISE_CLIENT_URLS: http://etcd1:2379
etcd2:
image: quay.io/coreos/etcd:v3.2.5
restart: always
ports:
- 23792:2379
- 23802:2380
volumes:
- ./certs/:/srv/
- /srv/docker/etcd:/etcd-data
environment:
ETCD_NAME: node2
ETCD_DATA_DIR: /etcd-data/etcd2.etcd
ETCDCTL_API: 3
ETCD_DEBUG: 1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd2:2380
ETCD_INITIAL_CLUSTER: node3=http://etcd3:2380,node1=http://etcd1:2380,node2=http://etcd2:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: etcd-ftw
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_ADVERTISE_CLIENT_URLS: http://etcd2:2379
etcd3:
image: quay.io/coreos/etcd:v3.2.5
restart: always
ports:
- 23793:2379
- 23803:2380
volumes:
- ./certs/:/srv/
- /srv/docker/etcd:/etcd-data
environment:
ETCD_NAME: node3
ETCD_DATA_DIR: /etcd-data/etcd3.etcd
ETCDCTL_API: 3
ETCD_DEBUG: 1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd3:2380
ETCD_INITIAL_CLUSTER: node3=http://etcd3:2380,node1=http://etcd1:2380,node2=http://etcd2:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: etcd-ftw
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_ADVERTISE_CLIENT_URLS: http://etcd3:2379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment