No internet access after added external network

Hey guys,

I’m a bit new to docker but getting deeper into it :slight_smile:
Now I have a docker swarm initialized and want to deploy a stack for my mariadb and an other stack for my nextcloud.

The mariadb stack works just fine. I’m able to access the adminer service webgui and can create tables users and so. I just want to use the mariadb as a seperate stack to be able to let other services use the db as well (not just nextcloud). After reading the docker wiki I found out that the old --link is depricated and I should use the possiblity to join containers to the same network.

What is the problem?
After adding an external network to my stack the internet access isn’t possible anymore from inside my nextcloud_app service. This leads into the issue of not beeing able to install calendar app f.e.

Ok so here are the facts:

mariadb got an overlay network that is named “mariadb_net”.

My nextcloud_app is deployed with a docker-compose.yml like this:

version: '3.7'

volumes:
  config:
  data:
  apps:
  
networks:
  backend:
  db:
    external: true
    name: mariadb_net

services:
  app:
    image: nextcloud:latest
    ports:
      - 8082:80
    networks:
      backend:
      db:
    volumes:
      - apps:/var/www/html/custom_apps
      - config:/var/www/html/config
      - data:/var/www/html/data
    restart: unless-stopped

  cron:
    image: nextcloud:latest
    networks:
      backend:
    volumes:
      - apps:/var/www/html/custom_apps
      - config:/var/www/html/config
      - data:/var/www/html/data
    entrypoint: /cron.sh
    restart: unless-stopped

  clam:
    image: mkodockx/docker-clamav:latest
    networks:
      backend:
        aliases: 
          - clam
    restart: unless-stopped

If I remove the network “db” from this docker-compose.yml the internet access is available again.

What am I doing wrong?
Thank you all in advance.