Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miguelangelgonzalez/682333f9d3d1e46e78d714671c73f5e9 to your computer and use it in GitHub Desktop.
Save miguelangelgonzalez/682333f9d3d1e46e78d714671c73f5e9 to your computer and use it in GitHub Desktop.
Create docker machine for elasticsearch
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