gliderlabs / registrator

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

Registrator setting wrong service names with consul, breaking DNS resolution #530

Open zd-carmo opened 7 years ago

zd-carmo commented 7 years ago

Description of the problem: When a container is brought up by referring to the image based on the SHA256 value instead of the label (so, /@sha256: instead of /:

How reproducible: Every time that the above situation is done.

Steps to Reproduce: a) Bring up a container by referring to the image by sha value. b) Check that the service got registered with the wrong name.

Actual Results: Service gets registered with name "@256"

Expected Results: Service gets registered with name ""

Additional info:

zyndaras commented 7 years ago

@zd-carmo:

You can override the service name (among other attributes) by providing a label to the container you want registered in the docker run command: --label "SERVICE_NAME=some-service-name"

or if you're using Compose v2 you can add:

labels:
  - "SERVICE_NAME=some-service-name"

Although it doesn't apply to your version, in case you upgrade to Docker 1.12+ swarm-mode services you'll need to add the following option to docker service create command: --container-label SERVICE_NAME=some-service-name

More details can be found in the service model documentation

Give it a try and let me know if it works!

alexinthesky commented 7 years ago

I had the same issue with docker 17.03. seems to be fixes with swarm mode and docker version 17.04.

A