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

Consul service registration and DNS #75

Open
peebles opened this issue Apr 30, 2015 · 4 comments
Open

Consul service registration and DNS #75

peebles opened this issue Apr 30, 2015 · 4 comments

Comments

@peebles
Copy link

peebles commented Apr 30, 2015

First of all, if I run:

$ docker run -d -p 8400:8400 -p 8500:8500 -p 8600:53/udp -h consul --name=consul progrium/consul -server -bootstrap -ui-dir /ui
$ curl http://$(docker-machine ip local):8500/v1/catalog/service/consul
[{"Node":"consul","Address":"172.17.0.17","ServiceID":"consul","ServiceName":"consul","ServiceTags":[],"ServiceAddress":"","ServicePort":8300}]

Why is "ServiceAddress" blank?

Then, when I run one of my containers:

cat /etc/resolv.conf

nameserver 172.17.42.1
nameserver 8.8.8.8
search service.consul

But:

ping consul

ping: unknown host consul

I noticed in Dockerfile (master), its using docker 1.5. I am using 1.6. So I tried my own image build with 1.6 but I get the same results.

I can ping:

ping 172.17.42.1

PING 172.17.42.1 (172.17.42.1) 56(84) bytes of data.
64 bytes from 172.17.42.1: icmp_seq=1 ttl=64 time=0.144 ms

and when I use registrator and run another service, that service does resolve properly. So it seems that the consul container itself is the one having problems.

** I am on OSX, using docker-machine.

@peebles
Copy link
Author

peebles commented Apr 30, 2015

Turns out that other services registered with registrator also do not resolve, I was wrong about that.

@JohnyDays
Copy link

Are you using an alpine-based container?

@peebles
Copy link
Author

peebles commented Aug 31, 2015

For registrater, yes:

FROM gliderlabs/alpine:3.1

ENTRYPOINT ["/bin/registrator"]

COPY . /go/src/github.com/gliderlabs/registrator

RUN apk-install -t build-deps go git mercurial \

&& cd /go/src/github.com/gliderlabs/registrator \

&& export GOPATH=/go \

&& go get \

&& go build -ldflags "-X main.Version $(cat VERSION)" -o /bin/registrator \

&& rm -rf /go \

&& apk del --purge build-deps

On Mon, Aug 31, 2015 at 3:30 AM, John Days [email protected] wrote:

Are you using an alpine-based container?


Reply to this email directly or view it on GitHub
#75 (comment)
.

@JohnyDays
Copy link

Hmm, if you were using it for other services, there is actually a problem with the dns search http://wiki.musl-libc.org/wiki/Functional_differences_from_glibc#Name_Resolver_.2F_DNS
I solved it by using consul.service.consul instead of just consul. Try it out
docker run --rm gliderlabs/alpine ping consul.service.consul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants