forked from docker/labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding in Docker for Windows support (docker#59)
* adding a powershell/hyperv version of the bash scripts for Docker for Windows users. Also cleaned up the documentation * Update README.md * Update README.md
- Loading branch information
Mano Marks
authored
Sep 30, 2016
1 parent
82ef9a0
commit dddf316
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Swarm mode using Docker Machine | ||
|
||
$managers=3 | ||
$workers=3 | ||
$SwitchName = "New Virtual Switch" | ||
|
||
# create manager machines | ||
echo "======> Creating manager machines ..." | ||
for ($node=1;$node -le $managers;$node++) { | ||
echo "======> Creating manager$node machine ..." | ||
docker-machine create -d hyperv --hyperv-virtual-switch $SwitchName ('manager'+$node) | ||
} | ||
|
||
# create worker machines | ||
echo "======> Creating worker machines ..." | ||
for ($node=1;$node -le $workers;$node++) { | ||
echo "======> Creating worker$node machine ..." | ||
docker-machine create -d hyperv --hyperv-virtual-switch $SwitchName ('worker'+$node) | ||
} | ||
|
||
# list all machines | ||
docker-machine ls | ||
echo "======> Initializing first swarm manager ..." | ||
$manager1ip = docker-machine ip manager1 | ||
|
||
docker-machine ssh manager1 "docker swarm init --listen-addr $manager1ip --advertise-addr $manager1ip" | ||
|
||
# get manager and worker tokens | ||
$managertoken = docker-machine ssh manager1 "docker swarm join-token manager -q" | ||
$workertoken = docker-machine ssh manager1 "docker swarm join-token worker -q" | ||
|
||
# other masters join swarm | ||
for ($node=2;$node -le $managers;$node++) { | ||
echo "======> manager$node joining swarm as manager ..." | ||
$nodeip = docker-machine ip manager$node | ||
docker-machine ssh "manager$node" "docker swarm join --token $managertoken --listen-addr $nodeip --advertise-addr $nodeip $manager1ip" | ||
} | ||
# show members of swarm | ||
docker-machine ssh manager1 "docker node ls" | ||
|
||
# workers join swarm | ||
for ($node=1;$node -le $workers;$node++) { | ||
echo "======> "worker$node" joining swarm as worker ..." | ||
|
||
docker-machine ssh "worker$node" "docker swarm join --token $workertoken --listen-addr $nodeip --advertise-addr $nodeip $manager1ip" | ||
} | ||
|
||
# show members of swarm | ||
docker-machine ssh manager1 "docker node ls" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
docker-machine stop (docker-machine ls -q) | ||
docker-machine rm --force (docker-machine ls -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Stop machines | ||
docker-machine stop worker1 worker2 worker3 manager1 manager2 manager3 | ||
docker-machine stop $(docker-machine ls -q) | ||
|
||
# remove machines | ||
docker-machine rm worker1 worker2 worker3 manager1 manager2 manager3 | ||
docker-machine rm $(docker-machine ls -q) |