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

Problems with connecting to etcd 2.0 that runs in a docker container #2253

Closed
ArtfulCoder opened this issue Feb 7, 2015 · 8 comments · Fixed by #2322
Closed

Problems with connecting to etcd 2.0 that runs in a docker container #2253

ArtfulCoder opened this issue Feb 7, 2015 · 8 comments · Fixed by #2322

Comments

@ArtfulCoder
Copy link
Contributor

I have been following this online page to run etcd in a container.
https://coreos.com/blog/Running-etcd-in-Containers/
The page talks about running etcd:0.4.6 in a container and it works.

When I tried doing this with etcd 2.0.0, the etcd service seems to start up but I am unable to connect to it via etcdctl.

(The docker images used below are hosted on dockerhub and are public)
------------- etcd 0.4.6 steps ----------------
The following command starts etcd 0.4.6 in docker, and works. I can connect to it with etcdctl.

docker run -p 4001:4001 kubernetes/etcd:0.4.6 /usr/local/bin/etcd -name abhi-master -addr hostname -i:4001

docker exec {container-id-that-just-started} /usr/local/bin/etcdctl -C="http://localhost:4001" ls
(this works)

------------- etcd 2.0.0 steps ----------------
The following command starts etcd 2.0.0 in docker, but can't connect to it via etcdctl.

docker run -p 4001:4001 kubernetes/etcd:2.0.0 /usr/local/bin/etcd --addr hostname -i:4001

docker exec {container-id-that-just-started} /usr/local/bin/etcdctl -C="http://localhost:4001" ls
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed)[0]

cc @dchen1107 @thockin

@xiang90
Copy link
Contributor

xiang90 commented Feb 7, 2015

@ArtfulCoder The default listen addr of 2.0 is localhost instead of 0.0.0.0. I think this might be the root cause.

@ArtfulCoder
Copy link
Contributor Author

@xiang90 I did try to connect to localhost using etcdctl within the container using "docker exec", but that did not resolve it.

@yichengq
Copy link
Contributor

I think this is because etcd 2.0 doesn't do backward compatibility well.
The fix is #2271 . Could you check whether it works for you?

@denisura
Copy link

etcd 2.0 uses port 2379 and 2380 (as opposed to etcd 0.4.6 which used 4001 and 7001.)

@yichengq
Copy link
Contributor

Does it work now?

@thockin
Copy link

thockin commented Feb 13, 2015

We're still wrestling with it - can someone @coreos post a canonical
'docker run' command that runs etcd 2.0 in a container and open a host port
that I can then connect to via etcdctl?

I am sure I am missing something simple

On Fri, Feb 13, 2015 at 11:39 AM, Yicheng Qin notifications@github.com
wrote:

Does it work now?

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

@kelseyhightower
Copy link
Contributor

@thockin I'm running through this now.

@kelseyhightower
Copy link
Contributor

@thockin See the etcd docker guide for working docker run commands for single, and multi-node etcd setups.

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

Successfully merging a pull request may close this issue.

6 participants