G
G
gubber2017-06-06 08:07:48
Docker
gubber, 2017-06-06 08:07:48

How to correctly set up docker swarm network on two nodes?

I have a simple project with two modules

version: "3.2"
services:
  vash_pes_tt:
    image:
      docker.gubber.ru/ru.gubber/vash_pes_tt:latest
    networks:
      vp-network:
        aliases:
          - server.docker
    deploy:
      placement:
        constraints:
          - node.role == manager
  vash_pes_tt_client:
    image:
      docker.gubber.ru/ru.gubber/vash_pes_tt_client:latest
    deploy:
      placement:
        constraints:
          - node.labels.MSK == 1
    networks:
      vp-network:
        aliases:
          - client.docker
networks:
  vp-network:

Set up swarm on two nodes. This configuration spreads two services to different nodes. Everything is good here. But the problem is that networks are different on different nodes.
When trying to ping from a client service, the following errors occur:
# docker exec 42bdd182cc5c ping 10.0.1.5
PING 10.0.1.5 (10.0.1.5): 56 data bytes
92 bytes from 42bdd182cc5c (10.0.1.3): Destination Host Unreachable

# docker exec 42bdd182cc5c ping server.docker
ping: unknown host

The vp-network network is not created from the console - network creation is at the mercy of the team
docker stack deploy -c docker-cloud.yml --with-registry-auth VP_STACK

How to properly organize the creation of a network so that two services can see each other?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question