Docker Community Forums

Share and learn in the Docker community.

Docker stack deploy, non default network pollution

Hey…
I think i’ve found a bug, or at least a functionality that I would describe as a bug.
We use docker stack deploy to create/update our services in a swarm.
We have over time managed to create a rather huge swarm with many nodes, and have now started deploying multiple “stacks” to this swarm.

Lets say i’ve got two stacks that I want to deploy to this “huge” swarm, a wordpress stack and a laravel stack.
In this example the wordpress_php services wants to connect to laravel_default network, which leads to my “bug”. Docker stack deploy is simply too nice

laravel-compose.yml

services:
  nginx:
    image: nginx:3.0.2
    environtment:
       FAST_CGI_PASS: php
  php:
    image: laravel:3.0.3

wordpress-compose.yml

services:
  nginx:
    image: nginx:3.0.2
    environtment:
       FAST_CGI_PASS: php
  php:
    image: wordpress:3.0.3
    networks:
      - default
      - laravel_default

Docker stack deploy will “help” by creating aliases for all my services in the default networks.
It will however also create a php alias for my wordpress_php service in the laravel_default network.
Effectively “polluting” the laravel_default network, and will effectively mean that my laravel_nginx will hit laravel_php and wordpress_php “randomly”.

Is this intended behavior, or just something that wasn’t thought of, when creating the docker stack deploy application?
I understand that “default” networks has special meaning, but I simply cannot see, how it is beneficial to non-default network attachments.

Yours
Mads Jon Nielsen