27

My question is similar to docker swarm init could not choose an IP address error, but I found the accepted answer somewhat vague so I'll ask again. Upon trying

docker swarm init

I'm geting an error message

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

What could be the root cause of this? I'm currently running a VPN (OneClickVPN); is that a problem?

Also, in order to specify one address with --advertise-addr, I'd like to find out more about the addresses given in the message. How could I do that?

Community
  • 1
  • 1
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526

5 Answers5

34

It looks like you have two active network interfaces, one on enp1s0 and another on wlp2s0. I'd guess enp1s0 is an Ethernet connection and wlp2s0 is a WiFi connection.

As mentioned in the question you linked to, if you have multiple addresses on different interfaces, you have to specify one with --advertise-addr. In your case, you're essentially choosing between your Ethernet and WiFi interfaces.

King Chung Huang
  • 5,026
  • 28
  • 24
  • 5
    Yes, the `enp1s0` is an Ethernet address as verified (in Ubuntu) by inspecting System Settings -> Network. `docker swarm init --advertise-addr 192.168.130.117` successfully initialized the swarm. – Kurt Peek Apr 27 '17 at 16:26
4

I used the following command:

docker swarm init --advertise-addr 127.0.0.1

It worked just fine.

Lucas Gabriel
  • 363
  • 3
  • 9
1

Most probably you were doing the following excercise (chapter 2): https://github.com/docker/labs/blob/master/beginner/chapters/alpine.md and then you moved to the chapter 3.

In addition to King's answer, you should check your default IP.

docker-machine ip default 
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
0

I only wanted to have a small swarm with 1 master node on my work laptop so I can run some tests.
So I did this:

docker swarm init --advertise-addr 127.0.0.1

And it worked just fine for what I needed

Fl_ori4n
  • 350
  • 2
  • 9
-3

That error looks two interface IP are running thats way your interface getting ambiguity, And its very simply to execute take your docker-machine's ip then hit,

Ex: docker swarm init --advertise-addr 111.111.11.111