docker-flow/docker-flow-swarm-listener

Not working with published port different from container port

Closed this issue · 2 comments

With a service created with port published like:

--publish 8081:8080 \
--label com.df.port=8081 \
--label com.df.serviceDomain=mydomain.com

The service works when accessed directly on a swarm node on port 8081. I have inspected the haproxy.cfg and Docker flow proxy appears to be configured correctly. However I always get 503 no service available Error when accessed via serviceDomain.

Simply changing the service to publish on same container port, like

--publish 8080:8080 \
--label com.df.port=8080 \
--label com.df.serviceDomain=mydomain.com

and it works fine.

You put a wrong value in com.df.port. That is the port of the process inside your containers, not the port you want (but shouldn't publish). DFP communicated with your applications through internal networking. com.df.port should always be the port your application listens to inside containers.

As a side note, there should be no need to publish ports.

Oh! That makes sense. Sorry, I misunderstood. Working fine now. Thanks !