Cannot connect to service port (not even from host of the container)

I’m having trouble connecting to service/container, even from the Windows Server 2022 host running the container. The target port on that container is accessible from all other containers, the application inside the container listens to 0.0.0.0:5454
When netstat -an is run on the host, the port 5455 or 5454 is not shown.

I have created a separate overlay network called net2:

NETWORK ID     NAME          DRIVER    SCOPE
ae4mivnst6c6   ingress       overlay   swarm
50df8b280fde   nat           nat       local
09991bced72a   none          null      local
2mkblk4fsrtd   net    overlay   swarm
wfvf9vd1p4bu   net2   overlay   swarm
  svc2:
    image: private_image_3
    isolation: 'process'
    ports:
      - 5455:5454
#      - target: 5454  ### when written like this the error I get is: starting container failed: failed to create endpoint others_stack_svc2.1.w1o3cb2vmnihqk3jwiuqom0hs on network net2: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists.
 #       published: 5455
  #      protocol: tcp
   #     mode: host
    environment:
      - rabbitmq_host=rabbitmq-1
      - rabbitmq_port=5672
      - rabbitmq_username=******
      - rabbitmq_password=******
      - rabbitmq_vhost=/
    deploy:
      #endpoint_mode: dnsrr ### error: port published with ingress mode can't be used with dnsrr mode
      # mode: global
      replicas: 1      
      restart_policy:
        condition: any
      placement:
        max_replicas_per_node: 1
        constraints:
          - node.labels.os == windows
    networks:
      - net2

networks:
  net2:
    external: true

It turns out after updating the Windows Server 2022 to 21H2 it all started working properly (that’s a weekend lost to nothing). I’m using Docker/Moby 24.0.2.

1 Like

Thank you for following up and sharing the solution!