registrator: Service is not registered with IP address when running with net=host
- What version of docker are you running?
docker version
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 05:33:38 2016
OS/Arch: linux/amd64
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 05:33:38 2016
OS/Arch: linux/amd64
- What version of registrator are you running? gliderlabs/registrator:latest
- Did you build a custom version of registrator? If so, what is that image? gliderlabs/registrator:latest
- What is the exact command you are running registrator with?
{% set containerName = 'registrator' %}
{% set image = 'gliderlabs/registrator:latest' %}
docker rm -f {{containerName}}:
cmd.run
#{% if 'main.davidkarlsen.com' in grains.get('id', []) %}
#docker create --name {{containerName}} --restart=always --log-driver=syslog --link consul-server:consul --volume=/var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://consul:8500:
# cmd.run
#{% elif 'linode.davidkarlsen.com' in grains.get('id', []) %}
#docker create --name {{containerName}} --restart=always --log-driver=syslog --volume=/var/run/docker.sock:/tmp/docker.sock --net=host gliderlabs/registrator:latest consul://192.168.3.1:8500:
# cmd.run
#{% endif %}
docker pull {{image}}:
cmd.run
docker create --name {{containerName}} --restart=always --hostname $HOSTNAME --log-driver=syslog --link consul-server:consul --net=bridge --volume=/var/run/docker.sock:/tmp/docker.sock {{image}} -deregister="always" -cleanup=true consul://consul:8500:
cmd.run
docker start {{containerName}}:
cmd.run
- What is the exact command you are running your container with? compose-file:
cat prometheus/files/docker-compose.yml
version: '2'
services:
prometheus:
image: prom/prometheus
ports:
- "192.168.3.1:9090:9090"
restart: always
network_mode: host
#mem_limit: 2g
logging:
driver: syslog
volumes:
- /srv/prometheus/data:/prometheus
- /srv/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
environment:
SERVICE_CHECK_HTTP: /graph
SERVICE_NAME: prometheus
grafana:
image: grafana/grafana
ports:
- "192.168.3.1:3001:3000"
volumes:
- /srv/grafana/data:/var/lib/grafana
restart: always
network_mode: bridge
logging:
driver: syslog
- If relevant,
Dockerfilefor application that is having issues. N/A
Description of the problem: Service is not registered with any address - I guess that’s because I’m running it with host=net
curl http://192.168.3.1:8500/v1/catalog/service/prometheus?pretty=true
[
{
"Node": "main",
"Address": "192.168.3.1",
"TaggedAddresses": {
"lan": "192.168.3.1",
"wan": "192.168.3.1"
},
"ServiceID": "main.davidkarlsen.com:prometheus_prometheus_1:9090",
"ServiceName": "prometheus",
"ServiceTags": [],
"ServiceAddress": "",
"ServicePort": 9090,
"ServiceEnableTagOverride": false,
"CreateIndex": 190054,
"ModifyIndex": 190064
}
]
How reproducible: See definitions above
Steps to Reproduce: See definitions above
Actual Results: There is no service-address
Expected Results: Expected to have it registered with the same IP as the host is running with
Additional info:
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
+1 - also having this issue.
Isn’t the issue here that identifying the correct IP is hard? With
--net=hosthow should registrator know which to use?-ipflag is really the best (only?) way to do this right. Might be nice to support something like-ip '{{ GetInterfaceIP "eth1" }}'like consul does though. Will look at submitting a PR if I get some time.