标签:驱动 nts 使用 ip地址 1.7 inspect mtu list 微软
1 # hostnamectl set-hostname etcd1.example.com 2 # hostnamectl set-hostname docker01.example.com 3 # hostnamectl set-hostname docker02.example.com
1 # mkdir -p /var/log/etcd/ #建议创建etcd日志保存目录 2 # mkdir -p /data/etcd #建议创建单独的etcd数据目录 3 # export HOST_1=172.24.8.71 #设置etcd节点的IP 4 # export DATA_DIR=/data/etcd #设置集群etcd数据节点 5 # REGISTRY=quay.io/coreos/etcd #建议使用此仓库 6 # ETCD_VERSION=latest #设置etcd版本 7 # export NAME_1=etcd1 #设置etcd节点的name 8 # docker volume create --name etcd-data
1 [root@etcd1 ~]# docker run 2 -p 2379:2379 3 -p 2380:2380 4 --volume=${DATA_DIR}:/etcd-data 5 --name etcd ${REGISTRY}:${ETCD_VERSION} 6 /usr/local/bin/etcd 7 --data-dir=/etcd-data --name ${NAME_1} 8 --initial-advertise-peer-urls http://${HOST_1}:2380 --listen-peer-urls http://0.0.0.0:2380 9 --advertise-client-urls http://${HOST_1}:2379 --listen-client-urls http://0.0.0.0:2379 10 --initial-cluster ${NAME_1}=http://${HOST_1}:2380
1 [root@etcd1 ~]# docker ps
1 [root@etcd1 ~]# docker exec -it bcb96fb0f987 /usr/local/bin/etcdctl cluster-health
1 [root@etcd1 ~]# docker exec -it bcb96fb0f987 /usr/local/bin/etcdctl --endpoints=http://${HOST_1}:2379 member list
1 [root@docker01 ~]# vi /etc/sysconfig/docker 2 OPTIONS=‘--cluster-store=etcd://172.24.8.71:2379 --cluster-advertise=172.24.8.72:2379‘ 3 [root@docker01 ~]# systemctl restart docker
1 [root@docker02 ~]# vi /etc/sysconfig/docker 2 OPTIONS=‘--cluster-store=etcd://172.24.8.71:2379 --cluster-advertise=172.24.8.73:2379‘ 3 [root@docker02 ~]# systemctl restart docker
1 [root@docker01 ~]# docker network create -d overlay overlaynet1 2 418654e0092f5d1c3e4bf2b9ee73cdd22932dd60fecf12d7a3b024818118244b 3 [root@docker01 ~]# docker network inspect overlaynet1
1 [root@docker02 ~]# docker network inspect overlaynet1
1 [root@docker01 ~]# docker run -d --name Container01 --network overlaynet1 training/webapp python app.py 2 [root@docker02 ~]# docker run -d --name Container02 --network overlaynet1 training/webapp python app.py 3 [root@docker01 ~]# docker exec -it 73e984a5528a /bin/bash 4 root@73e984a5528a:/opt/webapp# ifconfig
1 root@73e984a5528a:/opt/webapp# route -n
1 [root@docker02 ~]# docker exec -it 89eac9521743 /bin/bash 2 root@89eac9521743:/opt/webapp# ifconfig
1 [root@docker01 ~]# brctl show
1 [root@docker01 ~]# docker network ls
标签:驱动 nts 使用 ip地址 1.7 inspect mtu list 微软
原文地址:https://www.cnblogs.com/itzgr/p/10175652.html