Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"This node is not a swarm manager" error, but I'm not using docker swarm

For testing our escrow build, I'm attempting to set up a docker network that's isolated from the host and from the outside world.

I've got the following docker-compose.yml (inspired by this forum post):

version: '3'

services:
  redis:
    image: "redis:2.8.23"
    networks:
      - isolated

  # ... more services (TODO)

networks:
  isolated:
    driver: overlay
    internal: true

When I run docker-compose up -d; it creates the network, but then fails to create the containers, reporting the following:

ERROR: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

But I'm not using docker swarm, nor do I want to.

If I remove the services: stanza from the file, it brings up the network without the error. It warns that the network is unused (obviously).

If I remove the services/redis/networks stanza, it brings up the container correctly.

What am I doing wrong?

I found this answer, which uses driver: bridge for the network, but that still allows access to the host.


  • Docker version 18.09.3, build 774a1f4
  • docker-compose version 1.21.2, build a133471
like image 502
Roger Lipscombe Avatar asked Mar 08 '19 16:03

Roger Lipscombe


People also ask

What can I use instead of docker Swarm?

Kubernetes is an open source container orchestration platform that was initially designed by Google to manage their containers. Kubernetes has a more complex cluster structure than Docker Swarm.

What is manager node in docker Swarm?

When you run a swarm of Docker Engines, manager nodes are the key components for managing the swarm and storing the swarm state. It is important to understand some key features of manager nodes to properly deploy and maintain the swarm.

How does a docker swarm become a manager?

Join as a manager node When you run docker swarm join and pass the manager token, the Docker Engine switches into swarm mode the same as for workers. Manager nodes also participate in the raft consensus. The new nodes should be Reachable , but the existing manager remains the swarm Leader .


1 Answers

You have specified the network driver to be overlay.

The overlay network driver very much depends on swarm mode and can effectively be considered to be a swarm mode component.

Instead, you should choose a driver that is a local scope driver rather than a swarm scope driver.

The driver you should use is the bridge driver. The bridge network driver is not part of swarm mode and does not depend on swarm mode being active to utilize it.

Since you are using docker-compose, you can just leave the specific driver out entirely, and it will choose the appropriate driver for you. I would recommend removing the driver: overlay line out completely and leaving the rest of the file as-is:

version: '3'

services:
  redis:
    image: "redis:2.8.23"
    networks:
      - isolated

  # ... more services (TODO)

networks:
  isolated:
    internal: true
like image 168
programmerq Avatar answered Sep 17 '22 15:09

programmerq