gliderlabs / registrator

Service registry bridge for Docker with pluggable adapters
http://gliderlabs.com/registrator
MIT License
4.66k stars 912 forks source link

Add an option to force service port in service name #270

Open yoanisgil opened 8 years ago

yoanisgil commented 8 years ago

Hi there,

We're using registrator for our service discovery and we recently stumble into an issue related to service names and ports. So we had this image which exposed two ports (80, 443), so when containers were launched using that image services were registered with the port being part of the service name. So for containers created with this image, and launched like this:

docker run -P crakmedia/php56-fpm-nginx

services names were php56-fpm-nginx-443 and php56-fpm-nginx-80. Following this name convention we configured consul-template to look for services names with a given port number. This far all was good.

Recently we modify our base image to no longer expose port 443, and this of course broke our consul-template configuration since service names does not include the port number when a single port has been published. This is per-se not a bug but it would be nice if service name was consistent. At the same time I'm aware that forcing the port into the service name will break existing setups. I was thinking that an option could be added to registrator to always force ports.

What do you think?

I could create a PR for it if you find it suitable.

Bests,

Yoanis.

JnMik commented 8 years ago

+1

sergef commented 8 years ago

+1

thatsk commented 7 years ago

+1

sebastianpiskorski commented 7 years ago

+1