Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker swarm init could not choose an IP address error

Experimenting with Docker Swarm with Docker Desktop for Mac. I tried this:

docker-machine create -d virtualbox node-1
docker-machine create -d virtualbox node-2
docker-machine create -d virtualbox node-3

eval $(docker-machine env node-1)

docker swarm init \
    --secret my-secret \
    --auto-accept worker \
    --listen-addr $(docker-machine ip node-1):2377

The last command (docker swarm init) returns this error:

Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses

I have no idea what's going on. Anyone have any idea how to debug?

like image 443
Justin Avatar asked Sep 09 '25 16:09

Justin


1 Answers

First look for the public IP of your machine on your network

ifconfig

pick the physical one like 192.168.1.x (not docker0, that is a virtual IP internal to Docker)

docker swarm init --advertise-addr 192.1.68.1.x

(will default to port 2377)

like image 74
Genovo Avatar answered Sep 13 '25 05:09

Genovo