Docker Community Forums

Share and learn in the Docker community.

How to init a swarm on Windows 7 (as single node) with dynamic IP

docker
swarm

(Jmanko) #1

I have a Windows 7 laptop that I need to make a single node, and the IP address is dynamic. The problem is the following when trying to init the swarm:

From within Docker Quickstart Terminal:

$ docker swarm init
Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses on different interfaces (<examples>) - specify on with --advertise-addr

$ docker swarm init --advertise-addr 192.168.1.120 
Error response from daemon: must specify a listening address because the address to advertise is not recognized as a system address, and the system's IP address to use could not be uniquely identified

$ docker swarm init  --advertise-addr 192.168.1.120 --listen-addr 192.168.1.120
Error response from daemon: manager stopped: failed to listen on remote API address: listen tcp 192.168.1.120:2377: bind: cannot assign requested address

Below is docker version (install via the Docker Tookbox).

Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f51b1
 Built: Thu Jan 11 22:29:41 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:13:12 2018
  OS/Arch:      linux/amd64
  Experimental: false

(Jmanko) #2

So, I tried with 127.0.0.1 (both advertise and listen), and that seems to have worked as far as init’ing the swarm. Would using the loopback have any negative/side effects for accessing the containers, though? I can’t seem to access anything via their mapped ports in the compose file.

For instance, trying to access Portainer fails (not found), but it seems to be running just fine according to the logs:

docker service ls
ID                            NAME                             MODE                REPLICAS            IMAGE          PORTS
0ugklcrsxtw7        portainer_portainer     replicated         1/1                portainer/portainer:latest          *:4321->9000/tcp

and

docker service logs 0ugklcrsxtw7
portainer_portainer.1.vom7rarh9ccn@default    | 2018/02/07 20:37:45 Starting Portainer 1.16.1 on :9000

The docker-compose.yml:

version: '3'

services:
  portainer:
    image: portainer/portainer:latest
    ports:
      - "4321:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer:/data

volumes:
  portainer: