Created
May 2, 2017 14:22
-
-
Save miguelangelgonzalez/682333f9d3d1e46e78d714671c73f5e9 to your computer and use it in GitHub Desktop.
Create docker machine for elasticsearch
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
For ($i=1; $i -le 3; $i++) { | |
$node = "node-" + $i | |
docker-machine create -d hyperv --hyperv-virtual-switch "docker" --hyperv-memory 1024 $node | |
docker-machine ssh $node "echo 'vm.max_map_count=262144' | sudo tee -a /etc/sysctl.conf && sudo sysctl -p" | |
} | |
docker-machine env node-1 | Invoke-Expression | |
docker swarm init --advertise-addr $(docker-machine ip node-1) | |
$TOKEN = $(docker swarm join-token -q worker) | |
foreach ($i in 2,3){ | |
$node = "node-" + $i | |
$addr = $(docker-machine ip node-1) + ":2377" | |
docker-machine env $node | Invoke-Expression | |
docker swarm join --token $TOKEN $addr | |
} | |
docker-machine env node-1 | Invoke-Expression | |
docker node ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment