sh Apple macOS Sierra上的M节点主节点和N节点工作节点的脚本安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Apple macOS Sierra上的M节点主节点和N节点工作节点的脚本安装相关的知识,希望对你有一定的参考价值。

#!/bin/bash

#Script to setup M-node master node and N-node Worker Node running Docker 1.13.1 on Apple Mac Virtualbox

echo "--Setting up Docker Machine---"
curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && \
chmod +x /usr/local/bin/docker-machine

echo "--Verifying Docker Machine Installation--"
docker-machine version

echo "---Create manager-1"
docker-machine create -d virtualbox manager-1
manager_ip=$(docker-machine ip manager-1)

echo "---Swarm Init"
docker-machine ssh manager-1 docker swarm init --listen-addr ${manager_ip} --advertise-addr ${manager_ip}

printf "\n---Get Tokens\n"
manager_token=$(docker-machine ssh manager-1 docker swarm join-token -q manager)
worker_token=$(docker-machine ssh manager-1 docker swarm join-token -q worker)
echo ${manager_token}
echo ${worker_token}


for n in {2..3} ; do
	printf "\n---Create manager-${n}\n"
	docker-machine create -d virtualbox manager-${n}
	ip=$(docker-machine ip manager-${n})
	echo "--- Swarm Manager Join"
	docker-machine ssh manager-${n} docker swarm join --listen-addr ${ip} --advertise-addr ${ip} --token ${manager_token} ${manager_ip}:2377
done

for n in {1..3} ; do
	printf "\n---Create worker-${n}\n"
	docker-machine create -d virtualbox worker-${n}
	ip=$(docker-machine ip worker-${n})
	echo "--- Swarm Worker Join"
	docker-machine ssh worker-${n} docker swarm join --listen-addr ${ip} --advertise-addr ${ip} --token ${worker_token} ${manager_ip}:2377
done

printf "\n---Launching Visualizer\n"
docker-machine ssh manager-1 docker run -it -d -p 8080:8080 -e HOST=${manager_ip} -e PORT=8080 -v /var/run/docker.sock:/var/run/docker.sock manomarks/visualizer

printf "\n\n------------------------------------\n"
echo "To connect to your cluster..."
echo 'eval $(docker-machine env manager-1)'
echo "To visualize your cluster..."
echo "Open a browser to http://${manager_ip}:8080/"

以上是关于sh Apple macOS Sierra上的M节点主节点和N节点工作节点的脚本安装的主要内容,如果未能解决你的问题,请参考以下文章

sh 在macOS Sierra上的virtualenv中安装psycopg2

sh OSX Sierra网络性能调整#macOS

sh macOS Sierra에서원화(₩)대신백쿼트(`)입력하기

上一封 下一封 APPLE-SA-2019-3-25-2 macOS Mojave 10.14.4,Security Update 2019-002 High Sierra, Security Upd

macOS 10.12 Sierra 上的捆绑错误

markdown macOS Sierra上的本地SSL网站