Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost networks appears after export apply a stack #15

Open
joskfg opened this issue Jan 31, 2017 · 2 comments
Open

Ghost networks appears after export apply a stack #15

joskfg opened this issue Jan 31, 2017 · 2 comments

Comments

@joskfg
Copy link

joskfg commented Jan 31, 2017

Currantly when you export and import a complete stack the network between the different containers dissapears and appear a new independent network per container.

We can reproduce it following this steps:

docker-compose.yml

version: "3"

networks:
  app-network:

services:
  memcached:
    image: memcached
    networks:
      - app-network
  nginx:
    image: nginx:1.11.6-alpine
    volumes:
      - ./provision/files/nginx:/etc/nginx:ro
    networks:
      - app-network
    depends_on:
      - memcached

Deploying the stack

docker stack deploy app-test -c docker-compose.yml

Getting the DAB

whaleprint export

DAB obtained

{  
   "Version":"0.1",
   "Services":{  
      "memcached":{  
         "Image":"memcached:latest@sha256:2f5402d8f6f8b359f186e211448b857b6b715a87b2879b9b68aee8fb0e44c164",
         "Labels":{  
            "com.docker.stack.namespace":"app-test"
         },
         "ServiceLabels":{  
            "com.docker.stack.namespace":"app-test"
         },
         "WorkingDir":"",
         "User":"",
         "Networks":[  
            "memcached"
         ],
         "Replicas":1
      },
      "nginx":{  
         "Image":"nginx:1.11.6-alpine@sha256:aee97412fee873bd3d8fc2331b80862d7bd58913f7b12740cae8515edc1a66e4",
         "Labels":{  
            "com.docker.stack.namespace":"app-test"
         },
         "ServiceLabels":{  
            "com.docker.stack.namespace":"app-test"
         },
         "WorkingDir":"",
         "User":"",
         "Networks":[  
            "nginx"
         ],
         "Replicas":1
      }
   }
}

We can see here the unknown networks nginx and memcached, actually we have no app-test network that is the defined in the docker-compose.yml.

We can check the service running in the cluster.

docker service inspect app-test_memcached
 "Networks": [
                {
                    "Target": "m5xyqqv44mx0jwfpsoruts0gh",
                    "Aliases": [
                        "memcached"
                    ]
                }
            ],

We can see that the network has a memcached alias, but if we check the output of network list that network corresponds to the app-test_app-network.

m5xyqqv44mx0        app-test_app-network                          overlay             swarm

Seems that the whaleprint export just uses the names and not the identifier to know the network, so when you tries to apply the DAB it generates one different network for container instead of use one for all the containers.

@marcosnils
Copy link
Collaborator

@joskfg thx for reporting. Using the target field instead of the alias seems the best. We will have to make another query to the swam to get the current Target network name. Does that makes sense?

@joskfg
Copy link
Author

joskfg commented Feb 1, 2017

Yes, I think that it is the best solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants