Richard Rublev
Richard Rublev

Reputation: 8164

How to create docker overlay network?

My efforts to create overlay network are in vain.

docker network create --driver overlay new_network
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

Docker-machine list

 docker-machine ls
NAME              ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
dev               -        virtualbox   Stopped                                       Unknown    
swarm-manager-1   -        virtualbox   Running   tcp://192.168.99.103:2376           v18.09.5   

If I try

docker $(docker-machine config swarm-manager-1) swarm init --advertise-addr $(docker-machine ip swarm-manager-1)

it says

Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.

How to create overlay network? How to inspect the swarm?

I am on Ubuntu 18.04.

EDIT This works

docker $(docker-machine config swarm-manager-1) network create --driver overlay new_network
ym9wva4e8ejqji9cn61tf14kv

Anyway overlay network is not visible

docker network ls
NETWORK ID          NAME                                      DRIVER              SCOPE
ab450fe43ca5        bridge                                    bridge              local
14dbdf7dc1d9        chapter11_kong-net                        bridge              local
0a76583939bc        dockerapp_default                         bridge              local
b2c31f5e97c7        host                                      host                local
569e2a86568b        microservices-docker-go-mongodb_default   bridge              local
68174733413c        miki_default                              bridge              local
fbafcb186ac9        none 

Why?

Upvotes: 1

Views: 557

Answers (1)

Mihai
Mihai

Reputation: 10727

Most probably you have different configurations on your machine. You have to run the docker network command in the same context as the docker swarm command from your example:

docker $(docker-machine config swarm-manager-1) network create --driver overlay new_network

Upvotes: 1

Related Questions