Reputation: 11387
The documentation for etcd says that in order to connect to etcd from a job running inside a container, you need to do the following:
[...]you must use the IP address assigned to the docker0 interface on the CoreOS host.
$ curl -L http://172.17.42.1:2379/v2/keys/
What's the best way of passing this IP address to all of my container jobs? Specifically I'm using docker-compose
to run my container jobs.
Upvotes: 0
Views: 515
Reputation: 28160
The documentation you reference is making a few assumptions without stating those assumptions.
I think the big assumption is that you want to connect to an etcd that is running on the host from a container. If you're running a project with docker-compose
you should run etcd in a container as part of the project. This makes it very easy to connect to etcd. Use the name you gave to the etcd service in the Compose file as the hostname. If you named it etcd
, you would use something like this:
http://etcd:2379/v2/keys/
Upvotes: 2