containers-are-not-connected-in-docker-swarm

13 views
Skip to first unread message

Seyed Mohamad Reza Seyed Hoseini

unread,
Feb 1, 2020, 4:58:38 AM2/1/20
to docker-dev

I am running a service in docker swarm with docker-compose file and am working with 1 replica. But while making it scale to 4, the clients are not connected together.

What I mean is

  • client 1 connect container 1
  • client 2 connect container 2
  • client 3 connect container 3
  • client 4 connect container 4

I want all containers to connect together. I think the problem is with the network or config file of server that must be public for all containers.

My question is

  1. How to add shared storage for all containers on the manager of the swarm?
  2. How to add shared config folder for all containers on the manager of the swarm?
  3. How to connect all containers together for support and scale?

docker-compose.yml

version: "3.2"

services:
  nginx:
    build:
      context: ./nginx
      dockerfile: Dockerfile.dev
    volumes:
      - ./myservice/html:/app/dist
    ports:
        - "80:80"
        - "443:443"
    image: myservice_nginx:latest
  myservice:
    build:
      context: .
      dockerfile: Dockerfile.dev
    network_mode: "host"
    ports:
      - "9090:9090"
    image: myservicedocker_myservice:latest

Thank you all

Reply all
Reply to author
Forward
0 new messages