docker-machine create --driver hyperv --hyperv-virtual-switch ExternalSwitch registry
docker-machine ssh registry docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker-machine ls # get the ip address of the VM, in this case 10.10.10.197
docker-machine create --driver hyperv --hyperv-virtual-switch ExternalSwitch --engine-insecure-registry 10.10.10.197:5000 swarm-1
docker-machine create --driver hyperv --hyperv-virtual-switch ExternalSwitch --engine-insecure-registry 10.10.10.197:5000 swarm-2
docker-machine create --driver hyperv --hyperv-virtual-switch ExternalSwitch --engine-insecure-registry 10.10.10.197:5000 swarm-3
docker-machine ssh swarm-1 docker swarm init # copy the swarm join command to run on each other hose
docker-machine ssh swarm-2 docker swarm join --token SWMTKN-1-mysecrettoken 10.10.10.198:2377
docker-machine ssh swarm-3 docker swarm join --token SWMTKN-1-mysecrettoken 10.10.10.198:2377
& "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env swarm-1 | Invoke-Expression
In your functions set the function name so that it begins with the address of the registry, for example:
provider:
name: faas
gateway: http://10.10.10.198:8080 # use the IP address of the host swarm-1
network: "func_functions" # this is optional and defaults to func_functions
ruby-echo:
lang: ruby
handler: ./sample/ruby-echo
image: 10.10.10.197:5000/ruby-echo # use the IP of the local registry
That's a very cool example. Would make a good blog post!