0

I have a small docker swarm of 7 x Rpis:

ubuntu@rpi105:~/stacks$ docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
me5ma5mtkl98iutcztnyar7nf     rpi102     Ready     Active                          20.10.23
125x7tjps3om8qp4awmlt9nkn     rpi103     Ready     Active                          20.10.23
cxoluolounydb8wxydfhd0pd3     rpi104     Ready     Active                          20.10.23
6psveckpp209kx29je9bdug67 *   rpi105     Ready     Active         Leader           20.10.23
tva9hlxlsgsagoic92b5nsv9e     rpi106     Ready     Active         Reachable        20.10.23
qu2wboooaoux1kiy86yw2nkdk     rpi107     Ready     Active                          20.10.23
iu3nnacxqlz34lgy2tzzczxf2     rpi108     Ready     Active         Reachable        20.10.23

I can deploy services on command line without any problem, but when I try to deploy them with a stack file, it gets stuck. I am trying with this basic stack:

version: "3.9"

services:
  nginx_test:
    image: nginx:latest
    deploy:
      replicas: 1
    ports:
      - 81:80

Nothing is deployed no matter how many hours I wait. No error raise, but just stays forever in "New":

ubuntu@rpi105:~/stacks$ docker stack deploy -c test_nginx.yml testng
Creating network testng_default
Creating service testng_nginx_test
ubuntu@rpi105:~/stacks$ docker stack ps testng
ID             NAME                  IMAGE          NODE      DESIRED STATE   CURRENT STATE        ERROR     PORTS
owgslvqtbgfx   testng_nginx_test.1   nginx:latest             Running         New 21 minutes ago

Very suspiciously, the network that this command creates has no driver:

ubuntu@rpi105:~/stacks$ docker network ls
NETWORK ID     NAME             DRIVER    SCOPE
b19cd2106cf0   bridge           bridge    local
d6ecdf2de829   host             host      local
nys70xbvgset   ingress          overlay   swarm
46fa0761429f   none             null      local
mhggl0kyq5o5   testng_default             swarm

I don't know why it creates a network instead of using the ingress one.

Furthermore, if I manually create a network with a driver (overlay below), the network created has no driver:

ubuntu@rpi105:~/stacks$ docker network create -d overlay testnet
j5pg96332w5hvy7qoratpyvzc
ubuntu@rpi105:~/stacks$  docker network ls
NETWORK ID     NAME             DRIVER    SCOPE
b19cd2106cf0   bridge           bridge    local
d6ecdf2de829   host             host      local
nys70xbvgset   ingress          overlay   swarm
46fa0761429f   none             null      local
j5pg96332w5h   testnet                    swarm
mhggl0kyq5o5   testng_default             swarm
ubuntu@rpi105:~/stacks$ docker network inspect testnet
[
    {
        "Name": "testnet",
        "Id": "j5pg96332w5hvy7qoratpyvzc",
        "Created": "2023-02-02T19:30:36.372991984Z",
        "Scope": "swarm",
        "Driver": "",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "",
            "Options": null,
            "Config": null
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": null,
        "Options": null,
        "Labels": null
    }
]

Obviously, I am missing something. But after quite a few hours, I do not know what else I can do. Any help will be much appreciated.

For info, all Rpis in this cluster have:

  • Ubuntu 22.04.1 LTS
  • Docker Engine - Community 20.10.23
  • Docker Compose version v2.15.1
juan noguera
  • 135
  • 2
  • 3
  • 10

1 Answers1

0

The ingress overlay nw was totally messed up because of a wrong instruction in the ansible code that I used to create the swarm master:

    - name: Initialize Docker Swarm
      community.docker.docker_swarm:
        state: present
        advertise_addr: "{{ hostvars[inventory_hostname]['ansible_host'] }}"
        default_addr_pool: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}/24"   # <-- THIS ONE!
      ignore_errors: true
      tags: swarm

Commenting that line and recreating the whole swarm got it working to some point.

I am still having problems with nodes in the swarm that fail to attach to the ingress overlay, but this is for a different question.

juan noguera
  • 135
  • 2
  • 3
  • 10