Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of container name hostname for service name #267

bergtwvd opened this issue Oct 11, 2015 · 4 comments

Use of container name hostname for service name #267

bergtwvd opened this issue Oct 11, 2015 · 4 comments


Copy link

@bergtwvd bergtwvd commented Oct 11, 2015

I wonder if it is possible to use the container name (if set) or otherwise the hostname (if set) as the service name to be used by the registrator. Now I need to adapt my docker-compose files and define the environment variable SERVICE_NAME, which makes my files dependent on the behaviour of registrator.
So the behavior could be, in the following order:

  1. use SERVICE_NAME (if set)
  2. use container name (if set)
  3. use hostname (if set)
  4. use image name

-- Tom

Copy link

@Lawouach Lawouach commented Oct 22, 2015

Well, I can only agree with this improvement.

However, the ordering is not what I'd choose. The problem is with orchestrators like mesos/marathon that set very opaque names to containers unfortunately.

Considering what registrator is used for, I would expect this ordering:

  1. use hostname if set
  2. use container name if set
  3. use image name if set

As for the SERVICE_NAME... I'd drop its usage entirely.

Copy link

@bergtwvd bergtwvd commented Nov 3, 2015


As I also use Weave DNS in some setups, I do not want different docker-compose YML files. I do not want to assume different container names depending on Weave, Consul or some other DNS system.

Copy link

@mgood mgood commented Nov 3, 2015

Thanks for the feedback. More flexibility in the default naming scheme would be good, but we need to think more about how exactly to support it, since people may need different defaults depending on their setup.

One issue with the container name is that the Docker API doesn't seem to offer a way to distinguish names set by the user from its own auto-generated names. So, using the container name in registrator would need to be an explicit option for users that know that they will always set the name.

Copy link

@ketchoop ketchoop commented Oct 14, 2016

Are there any news about this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.