docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.75k stars 1.08k forks source link

How to create overlay network on (manual setup of) Docker Swarm standalone? #2843

Closed smattheis closed 4 years ago

smattheis commented 6 years ago

I have a Docker Swarm (standalone) setup where I started swarm containers partially manually: The master is created just with docker run <some options> swarm manage <more options> and a bunch of nodes, which I would like to administer with Docker Machine, with docker-machine create --driver generic <some options> --swarm <more options>. The setup works perfectly but I'm not able to create an overlay network for my swarm cluster:

$ docker network create --driver overlay swarm-net
Error response from daemon: 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 network create --driver overlay --subnet=10.0.9.0/24 swarm-net
Error response from daemon: 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.

To analyze the problem, I also followed the documentation for creating a swarm with Docker Machine, see https://docs.docker.com/network/overlay-standalone.swarm/#create-a-swarm-cluster. There, it seems that it's sufficient to connect to the swarm via connect infos for the master as given shown with docker-machine env --swarm swarm-master. This is the same I do for my swarm cluster but I manually set environment variables because it wasn't created with Docker Machine. This works perfectly since I see all the swarm info and can manage containers without any problem:

$ env | grep DOCKER
DOCKER_HOST=tcp://10.10.92.2:3376
DOCKER_TLS_VERIFY=1
DOCKER_CERT_PATH=/home/swarm/.certs/
$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
7ef594739582        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-18/swarm-agent
437d68d9733d        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-17/swarm-agent
996831a84f08        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-16/swarm-agent
c82d90125229        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-15/swarm-agent
7a646ef6fe1b        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-14/swarm-agent
11c4d411e3a1        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-13/swarm-agent
099957feb837        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-12/swarm-agent
e298b1d0e129        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-11/swarm-agent
b3bead62d3c5        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-10/swarm-agent
3b69e989c915        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-9/swarm-agent
b03e93bf4c00        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-8/swarm-agent
08cd86de9aa8        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-7/swarm-agent
3e9f1c66347e        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-6/swarm-agent
02db65bce678        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-5/swarm-agent
0d8d4023e5ea        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-4/swarm-agent
16a70f7a11c7        swarm:latest        "/swarm join --adv..."   4 months ago        Up 30 hours         2375/tcp            node-3/swarm-agent
da35d78913a1        swarm:latest        "/swarm join --adv..."   5 months ago        Up 30 hours         2375/tcp            node-2/swarm-agent
0062316f2ec8        swarm:latest        "/swarm join --adv..."   5 months ago        Up 30 hours         2375/tcp            node-1/swarm-agent

$ docker info
Containers: 18
 Running: 18
 Paused: 0
 Stopped: 0
Images: 72
Server Version: swarm/1.2.8
Role: primary
Strategy: spread
Filters: health, port, containerslots, dependency, affinity, constraint, whitelist
Nodes: 18
 node-1: 10.10.92.11:2376
  └ ID: U4Q6:V5B2:SIWA:KJGV:6ZT2:N65Q:6XFZ:ZBST:PYKL:5ZXP:NKMS:F2SD|10.10.92.11:2376
  └ Status: Healthy
  └ Containers: 1 (1 Running, 0 Paused, 0 Stopped)
  └ Reserved CPUs: 0 / 8
  └ Reserved Memory: 0 B / 32.67 GiB
  └ Labels: kernelversion=4.4.0-112-generic, operatingsystem=Ubuntu 16.04.3 LTS, ostype=linux, provider=generic, storagedriver=aufs
  └ UpdatedAt: 2018-02-16T16:03:42Z
  └ ServerVersion: 17.09.0-ce
...
Plugins: 
 Volume: 
 Network: 
Swarm: 
 NodeID: 
 Is Manager: false
 Node Address: 
Kernel Version: 4.4.0-112-generic
Operating System: linux
Architecture: amd64
CPUs: 144
Total Memory: 588.1GiB
Name: 110462c70018
Docker Root Dir: 
Debug Mode (client): false
Debug Mode (server): false
Experimental: false
Live Restore Enabled: false

WARNING: No kernel memory limit support

Is there something wrong in my setup? Do I misunderstand something about overlay networks such that it's actually impossible in my case or needs some additional stuff? (I don't use DNS in my setup.) Is it possible that it's a compatibility issue with Docker Swarm Mode since it kind of checks if I ran swarm join or swarm init on my local Docker Engine, which I didn't of course because I'm using Docker Swarm standalone? I appreciate any useful hint and can provide more information if needed.