Docker Community Forums

Share and learn in the Docker community.

Swarm create network error


(Feliperoberto) #1

I was trying to use the docker network,
but I am getting this error:

docker --tlsverify
–tlscacert=/var/lib/boot2docker/ca.pem --tlscert=/var/lib/boot2docker/server.pem --tlskey=/var/lib/boot2docker/server-key.pem
–cluster-advertise 192.168.99.101:2376
–cluster-store consul://192.168.99.101:8500
network create -d overlay net

Error response from daemon: 500 Internal Server Error: failed to parse pool request for address space “GlobalDefault” pool “” subpool “”: cannot find address space GlobalDefault (most likely the backing datastore is not configured)

I have a swarm with 3 machines:
mh-keystore;
node1;
node2;
The machines was created with docker-machine, but the consul and swarm is running as docker images ( not as docker-machine integration )

After create the 3 machines with -d virtualbox i run ( pausing between line to get time to work fine )

eval "$(docker-machine env mh-keystore)"
docker run -d -p 8500:8500 --name=consul progrium/consul -server -bootstrap
docker run -d -p 4000:4000 -v /var/lib/boot2docker:/certs:ro swarm manage -H :4000 --tls --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/server.pem --tlskey=/certs/server-key.pem --replication --advertise=$(docker-machine ip mh-keystore):4000 consul://$(docker-machine ip mh-keystore):8500
eval "$(docker-machine env node1)"
docker run -d swarm join --advertise=$(docker-machine ip node1):2376 consul://$(docker-machine ip mh-keystore):8500
eval "$(docker-machine env node2)"
docker run -d swarm join --advertise=$(docker-machine ip node2):2376 consul://$(docker-machine ip mh-keystore):8500
eval “$(docker-machine env mh-keystore)”
/#docker-machine ssh mh-keystore

docker -H $(docker-machine ip mh-keystore):4000 info

Do you know what’s happening with my attempt? Is it any typo?

Thank you!


(Nathan Le Claire) #2

Hm, back up a second. You’re passing --cluster-advertise and --cluster-store to a Docker client command, that should pretty much never happen as far as I’m aware. Those need to be set as options on the created Docker daemon if you’re going to use multi-host networking. In order to do so, you could use the Machine --engine-* options or, manually edit /var/lib/boot2docker/profile to add them.

Replaying the other commands you’ve run:

eval "$(docker-machine env mh-keystore)"
docker run -d -p 8500:8500 --name=consul progrium/consul -server -bootstrap

This looks fine, it will set up the key value store for usage. I think in the examples before we set --hostname consul but I don’t think that matters.

docker run -d \
    -p 4000:4000 \
    -v /var/lib/boot2docker:/certs:ro \
    swarm manage -H  :4000 --tls --tlsverify --tlscacert=/certs/ca.pem \
    --tlscert=/certs/server.pem --tlskey=/certs/server-key.pem --replication \
    --advertise=$(docker-machine ip mh-keystore):4000 \
    consul://$(docker-machine ip mh-keystore):8500

Maybe I’m misunderstanding this, but I am not 100% sure you can combine manage and --advertise like this, might work though. I’d also try to get a simple example working before throwing --replication in.

eval "$(docker-machine env node1)"
docker run -d swarm join --advertise=$(docker-machine ip node1):2376 consul://$(docker-machine ip mh-keystore):8500
eval "$(docker-machine env node2)"
docker run -d swarm join --advertise=$(docker-machine ip node2):2376 consul://$(docker-machine ip mh-keystore):8500
eval "$(docker-machine env mh-keystore)"

docker-machine ssh mh-keystore

docker -H $(docker-machine ip mh-keystore):4000 info

These commands look OK.

What is the output of docker logs for the Swarm manager, and join processes?

Can you verify that the Consul container is available? i.e. that it is running, the logs show it looks healthy, and that it responds to something like curl -L $(docker-machine ip mh-keystore):8500/v1/catalog/nodes ?


(Feliperoberto) #3

Yep, the logs shows me that everything was as expected and both nodes are healthy.
The mistakes was corrected editing /var/lib/boot2docker/profile as you mentioned. Now I can create an overlay network.
Thank you!