3

I'm running Windows 10 with the latest updates installed. I'm trying to set up a swarm using multiple physical hosts running docker Linux containers on windows host. When I'm running

docker swarm init --advertise-addr 10.154.26.150 --listen-addr 10.154.26.150:2377

Where

10.154.26.150

stands for physical address of my current machine (future swarm manager) I obviously receive

Error response from daemon:
manager stopped:
failed to listen on remote API address: listen tcp 10.154.26.150:2377 
bind: cannot assign requested address

because docker for Windows running Linux containers uses hyper-v vm and doesn't know anything about address I'm trying to specify. So here is a question if there is any small possibility to run swarm mode in this situation so that my other hosts will be able to join new swarm over physical network.

Andrew
  • 51
  • 1
  • 5
  • I have the same issue and created a question in the DevOps section of StackExchange: https://devops.stackexchange.com/questions/4161/join-a-linux-docker-swarm-with-a-local-windows-docker-for-test-purposes. Do you have any news on the subject? Did you solved it? – Paul Rey May 24 '18 at 15:49

1 Answers1

4

If you're using "Docker for Windows", which runs a Moby VM in Hyper-V and simulates localhost, then it's easy for a single node Swarm setup. It's not yet designed to easily join outside machines.

If you want to have a 3-node swarm to spread out your testing, where they all have easy direct access to each other, then I recommend using docker-machine to create 3 more VM's in Hyper-V running boot2docker, like so:

docker-machine create --driver hyperv --hyperv-virtual-switch "Primary Virtual Switch" node1
docker-machine create --driver hyperv --hyperv-virtual-switch "Primary Virtual Switch" node2
docker-machine create --driver hyperv --hyperv-virtual-switch "Primary Virtual Switch" node3

NOTE: For this to work, 1. Be sure you're in PowerShell admin mode so docker-machine can control Hyper-V and 2. You'll need to create an "external" Hyper-V Switch and use its name in creating the VM's.

Details on the switch setup, and other options like changing CPU and memory are in the docker-machine docs.

Then you can change your docker CLI to control each one directly with & docker-machine env nodeX | Invoke-Expression and ssh into them with docker-machine ssh nodeX etc.

I use this setup and it works great!

Bret Fisher
  • 8,164
  • 2
  • 31
  • 36
  • 1
    Well thank you, but it's just a single host, and this works like a charm even for me. Buy I'm trying to create a swarm across multiple host machines so they can act like a cluster. I'm assuming it doesn't work for me because of linux kernel proxy in my hyper-v Moby VM, because when I switch to windows containers I can create a swarm using my physical ip-address and other machines (running linux containers) can join my swarm. But in this case I can't make them connect to each other using overlay network (while same-host communications in the same node works fine). Digging it now. – Andrew Dec 10 '17 at 18:48