Docker Community Forums

Share and learn in the Docker community.

How to host multiple services in swarm accessible from public internet


(Mmihey) #1

Hi docker users,

Could please someone help me out getting started with swarm mode… How can I run multiple separate services in swarm which are accessible from the public internet over an 80 port (resolving to a domain name)?

I know that only one service can be bound to port 80. Am I right tat nginx proxy service should be running on port 80 with a forwarding to the appropriate service in a swarm? eg, domain-a.com is forwarded to swarm service A and domain-b.com to swarm service B?

I couldn’t find any docs or hints on this one and most likely because this is an obvious question. Any hints or guides are much appreciated. Thank you.


(Basi) #2

You could use one of the existing projects that try to do exactly this.
For example you could give a try to:

  • Docker flow proxy: It’s based on HAProxy, you can confiture it by its REST endpoint or automatically via labels when you launch your services. Here you have info about it, easy: https://github.com/vfarcic/docker-flow-proxy/blob/master/articles/swarm-mode-listener.md

  • Traefik: It has more features than Flow Proxy and can be configured via labels as well, but its swarm support is still RC. I’ve had some stability issues with the RC release but it’s a very promising project. It needs more time to be configured properly, because it has lots of options and the swarm documentation is still not finished. https://github.com/containous/traefik

  • Swarm Ingress Router: Another option, it follows the same principle than the others and can be configured via labels too. It’s very simple and it works, but I don’t know if it’s ready for production usage. It uses go libraries to do the routing in a similar way traefik. https://github.com/tpbowden/swarm-ingress-router

I have tried all three and in case I need to use one of them in production I would use Flow Proxy because is based in HAProxy, which is rock solid software, but it does not have all the features Traefik has, which on other hand is still RC.


(Mmihey) #3

Thank you for the links! I will study them. Docker changes so rapidly and as a result, many help materials are outdated and don’t apply to current Docker version.