crosbymichael / skydock

Service discovery via DNS for docker
MIT License
1.06k stars 88 forks source link

Terminal hanging on example for redis login #36

Open NathanZook opened 10 years ago

NathanZook commented 10 years ago

docker run -t -i crosbymichael/redis-cli -h redis1.redis.dev.docker redis1.redis.dev.docker:6379>

I get no response from the terminal. ^C in the terminal kills the session to the redis host, but I'm not at all sure what's really happening there.

Running on a Mac, 10.9.1. Vagrant 1.3.5 Virtual box 4.3.0 r89960 Using the docker image from the demo on the website. Hacked docker.conf until it didn't start on reboot & ran docker by hand with options from your example.

NathanZook commented 10 years ago

A bit more information:

vagrant@precise64:~$ docker ps
CONTAINER ID        IMAGE                            COMMAND                CREATED             STATUS              PORTS                              NAMES
d921dd67d15a        crosbymichael/redis-cli:latest   redis-cli -h redis1.   2 hours ago         Up 2 hours                                             stoic_shockley          
5a227fec889f        crosbymichael/redis:2.8          redis-server --dir /   2 hours ago         Up 2 hours          6379/tcp                           redis1                  
03613ee21eaa        crosbymichael/skydock:latest     skydock -ttl 30 -env   2 hours ago         Up 2 hours                                             skydock                 
3fb1449acc7f        crosbymichael/skydns:latest      skydns -http 0.0.0.0   2 hours ago         Up 2 hours          172.17.42.1:53->53/udp, 8080/tcp   skydns,skydock/skydns   

vagrant@precise64:~$ curl redis.dev.docker
curl: (6) Couldn't resolve host 'redis.dev.docker'
vagrant@precise64:~$ curl redis1.redis.dev.docker
curl: (6) Couldn't resolve host 'redis1.redis.dev.docker'

So it looks like something isn't set up correctly...

asbjornenge commented 10 years ago

@student can you do a dig at the docker interface? Like so:

dig @172.17.42.1 redis.dev.docker

whats the output?

NathanZook commented 10 years ago
vagrant@precise64:~$ dig @172.17.42.1 redis.dev.docker

; <<>> DiG 9.8.1-P1 <<>> @172.17.42.1 redis.dev.docker
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38757
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;redis.dev.docker.      IN  A

;; ANSWER SECTION:
redis.dev.docker.   8   IN  A   172.17.0.4

;; Query time: 7 msec
;; SERVER: 172.17.42.1#53(172.17.42.1)
;; WHEN: Fri Feb 21 17:03:12 2014
;; MSG SIZE  rcvd: 66

Note: I realized that my vagrant image from docker was likely out of date. I updated my vagrant files, fixed /etc/init/docker.conf, an reran. Same results.

asbjornenge commented 10 years ago

As you can see by the ANSWER SECTION, doing a dns query against 172.17.42.1 it can find the ip of your redis server.

So, it works :-)

But you either need to perform the curl inside a container (they all should have 172.17.42.1 as their nameserver now, if you followed Michaels guide), or you need to add 172.17.42.1 as the nameserver inside vagrant (/etc/resolv.conf)

NathanZook commented 10 years ago

Okay. That explains the curl failure. It doesn't explain the terminal hanging on the last command...

docker run -t -i crosbymichael/redis-cli -h redis1.redis.dev.docker
redis1.redis.dev.docker:6379>

:(

asbjornenge commented 10 years ago

Yeah, thats a bit weird. What version of docker are you running?

docker -v

I don't see that issue here. Can you run another image in the foreground?

docker run -i -t ubuntu /bin/bash
mgenov commented 10 years ago

I'm encountering same issue on my side.

mgenov:~() $ docker ps
CONTAINER ID        IMAGE                          COMMAND                CREATED             STATUS              PORTS                           NAMES
c5e54e9e9ba5        crosbymichael/redis:latest     redis-server --bind    32 minutes ago      Up 32 minutes       0/tcp                           redis1
99a1af6c820c        crosbymichael/skydock:latest   /go/bin/skydock -ttl   33 minutes ago      Up 33 minutes                                       skydock
286e945d29be        crosbymichael/skydns:latest    skydns -http 0.0.0.0   About an hour ago   Up About an hour    172.17.42.1:53->53/udp, 0/tcp   skydns
mgenov:~() $

Output of docker version (Mac OS 10.9.4, boot2docker)

mgenov:~() $ docker version
Client version: 0.8.1
Go version (client): go1.2
Git commit (client): a1598d1
Server version: 1.1.0
Git commit (server): 79812000
Go version (server): go1.2.1
mgenov:~() $

It seems that skydock is working, cause it shows reasonable messages in the console:

[info] 1404905129 skydock: loading plugins from /plugins/default.js
[info] 1404905129 skydock: skydns URL: http://172.17.0.2:8080
[debug] 1404905129 skydock: starting restore of containers
[info] 1404905129 skydock: adding 99a1af6c82 (skydock) to skydns
[info] 1404905129 skydock: adding 286e945d29 (skydns) to skydns
[debug] 1404905129 skydock: starting main process
[debug] 1404905193 skydock: received event (destroy) c02aff3a0f70c98eed7d8260b832779b23b191a348e96694c4944908be3d6269 crosbymichael/redis:latest
[debug] 1404905195 skydock: received event (create) c5e54e9e9ba5f77ac0303fb5552c01aa85a3524785a77e055794e420cca8ec6c crosbymichael/redis:latest
[debug] 1404905196 skydock: received event (start) c5e54e9e9ba5f77ac0303fb5552c01aa85a3524785a77e055794e420cca8ec6c crosbymichael/redis:latest
[info] 1404905196 skydock: adding c5e54e9e9b (redis) to skydns
[debug] 1404905214 skydock: received event (create) 5787303dac4a28e945593af03a74efa135f4b720d27707cbafbebf0d5ec5d161 crosbymichael/redis-cli:latest
[debug] 1404905214 skydock: received event (start) 5787303dac4a28e945593af03a74efa135f4b720d27707cbafbebf0d5ec5d161 crosbymichael/redis-cli:latest
[info] 1404905214 skydock: adding 5787303dac (redis-cli) to skydns