Using Docker-Swarm to duplicate Docker-Compose?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Using Docker-Swarm to duplicate Docker-Compose?

836 次查看
Angelcrazy123
Contributor I

As part of my Docker Certification, I have to a project that contains 1 docker-compose file that runs 4 services that communicate with each other. These four services act like a 1 tank controller and 3 tank sensors. I want to duplicate the entire docker-compose with all four services using Docker Swarm. Here is an image of what I'm trying to do: an image showing the final goal

I am having a lot of confusion when setting up the docker swarm. I ran the following commands:

docker swarm init
docker stack deploy --compose-file=docker-compose.yml tank

But this set up only lets me scale one service at a time. For example:

docker service scale tank_lowlevelalarm=4

This isn't what I want to do. I want to be able to scale the entire docker-compose by replicating all four services at the same time. My goal is that on my overlay network, it will look like I have multiple tanks, and each tank has 1 controller and 3 sensors. Is it possible for me to do this?

My docker-compose file, for reference:

version: '3.0'
services:
  tli:
    image: tli
    networks:
      - my-overlay

  lowlvlalarm:
    image: lowlvlalarm
    build: .
    networks:
      - my-overlay

  highlvlalarm:
    image: highlvlalarm
    build: ./HighLvlAlarm
    networks:
      - my-overlay

  plc:
    image: plc
    depends_on:
      - tli
      - lowlvlalarm
      - highlvlalarm
    networks:
      - my-overlay

networks:
  my-overlay:  

 

0 项奖励
回复
0 回复数