Cannot connect to docker swarm services as a client

Situation
I have a TCP server that echos back all requests, I was able to run it in a docker container and the client was able to connect to the service through the published port on the Host machine IP.

Now I am trying to run the service in a swarm cluster

  • I deployed the service to the worker nodes
  • The service has published the PORT that the server is binding/listening on using the -p 50:50 flag (the service is running on port 5050)
  • The client should connect to the MANAGER_NODE:PORT

Issue :
when the client connects to the MANAGER_IP:PORT, I get a ConnectionRefusedError: [Errno 111] Connection refused

Question :
How will the client connect to the service? I would like to set it so that the client will send the request to the MANAGER_NODE_IP:SERVICE_PORT and the swarm load balancer to forward the connection to the service on the worker node.

Sources :
you can find the server, client and Dockerfile here

I am still learning about docker swarm and the overlay network so any info is appreciated.