I have 2 Machines, one initialized as manager and others joined as a worker. I have a nodejs application and redis, where redis is in the manager node.
When I try to scale nodejs application service, replicas in Manager node can discover Redis but containers in worker node couldn’t
I have replaced the host name ‘hp-redis’ with IP, but I don’t want to do this in production environment
services: api: image: 'xxxx' ports: - '3000:3000' volumes: - type: volume source: hp-api-dev target: /usr/src/app/ - type: volume source: logs target: /usr/src/app/logs/ - type: bind source: /var/www/xxxx/ target: /uploads - type: bind source: /etc/localtime target: /etc/localtime read_only: true deploy: replicas: 1 restart_policy: max_attempts: 3 condition: on-failure update_config: parallelism: 1 delay: 10s networks: - webnetwork depends_on: - hp-redis hp-redis: image: 'redis:4.0' deploy: mode: global restart_policy: condition: on-failure resources: limits: cpus: '0.1' memory: 100M placement: constraints: - 'node.role == manager' ports: - '6379:6379' expose: - "6379" volumes: - type: bind source: /Data/redis/ target: /home/docker/data read_only: true networks: - webnetwork networks: webnetwork: driver: overlay volumes: hp-api-dev: logs: