Docker swarm networking hostnames and service names

You are right, dnsrr and ingress are incompatible:

version: '3.7'
services:
  docker-demo:
    image: ehazlett/docker-demo
    deploy:
      mode: replicated
      replicas: 3
      endpoint_mode: dnsrr
    ports:
    - target: 8080
      published: 8080
      protocol: tcp
      mode: ingress

docker stack deploy -c docker-compose.yml docker-demo

failed to create service docker-demo_docker-demo: Error response from daemon: rpc error: code = InvalidArgument desc = EndpointSpec: port published with ingress mode can’t be used with dnsrr mode

I wasn’t aware both can not be combined. Usualy I publish ports on a reverse proxy container and declare the target containers as upstream. Typicaly I use dnsrr for databases or kafka - both don’t require published ports in my use cases, though my client applications are troubled by the vip’s timeout.

Actually, I am surprised this doesn’t work. Ingress is nothing more then a globaly bound port on all nodes where traffic is forwarded to a target service and port using an overlay network… honestly nothing fency. I have no idea why this was designed to not work with dsnrr…