moby: docker swarm init --advertise-addr 172.17.0.1 doesn't work

I want to be able to run swarm on my laptop without it having a stable external ip, so I want to be able to use the docker0 ip (172.17.0.1) as the advertise address. The only machine that ever needs to connect to it is itself, so nothing will break and it would be nice if I could do this.

Output of docker version:

Client:
 Version:      1.13.0-dev
 API version:  1.25
 Go version:   go1.6.3
 Git commit:   b2b41b2
 Built:        Tue Aug  9 00:20:23 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0-dev
 API version:  1.25
 Go version:   go1.6.3
 Git commit:   b2b41b2
 Built:        Tue Aug  9 00:20:23 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 78
 Running: 18
 Paused: 0
 Stopped: 60
Images: 368
Server Version: 1.13.0-dev
Storage Driver: overlay2
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: overlay bridge host null
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.6.4-1-ARCH
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.709 GiB
Name: compooter
ID: GKSI:YHZC:YPNI:PAGO:EYPD:AYME:K6BY:BAIH:EBKQ:SOAK:WUFP:6MJM
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 140
 Goroutines: 190
 System Time: 2016-08-08T17:32:38.045062203-07:00
 EventsListeners: 1
Username: viktorstanchev
Registry: https://index.docker.io/v1/
Cluster Store: etcd://172.17.0.1:12379
Cluster Advertise: 172.17.0.1:12376
Insecure Registries:
 172.17.0.1
 192.168.0.106
 dtr2-2061409770.us-west-2.elb.amazonaws.com
 new-1428125395.us-west-2.elb.amazonaws.com
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.): physical

Steps to reproduce the issue:

  1. docker swarm init --advertise-addr 172.17.0.1

Describe the results you received:

Error response from daemon: must specify a listening address because the address to advertise is not recognized as a system address

Describe the results you expected: success

Additional information you deem important (e.g. issue happens only occasionally):

When run docker swarm init without arguments it returns:

Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses on different interfaces (192.168.203.47 on wlp2s0 and 192.168.101.27 on enp0s20u2u3) - specify one with --advertise-addr

It looks like docker is trying to be user friendly but in this case it’s breaking my use case.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Update: Thanks @stevvooe docker swarm init --advertise-addr 172.17.0.1 --listen-addr 0.0.0.0 works

docker-machine ssh1 vm1 “docker swarm init --advertise-addr 192.168.99.100 --listen-addr 127.0.0.1”

docker-machine ssh myvm1 “docker swarm init --advertise-addr <myvm1 ip> --listen-addr <HOST IP (VM IP)>” TRY THIS, should work!!!

@stefanberger The docker-machine output you have shows that default is selected. If you want to configure manager1, you need to select it.

This error occurs by following the tutorial and documentation step by step on mac. A note in the documentation regarding this issue and what causes it would help newcomers.