I have a Cement
application that runs inside of a docker container. In this image I have to connect to etcd. Inside of my docker image I have config that for etcd is set to localhost
that I know is not correct!
On my local machine etcd is up and running:
tcp4 0 0 localhost.2379 localhost.51949 ESTABLISHED
The question is how should I connect to etcd
server which is outside of docker container? etcd
is installed normally without using docker.
Output of my python application when I run it with docker run -p 8084:8084 my_python_image
:
Traceback (most recent call last):
File "my_app.py", line 64, in <module>
app.run()
File "/usr/local/lib/python2.7/site-packages/cement/core/foundation.py", line 882, in run
return_val = self.controller._dispatch()
File "/usr/local/lib/python2.7/site-packages/cement/core/controller.py", line 477, in _dispatch
return func()
File "my_app.py", line 45, in default
module_rpc = rpc.Rpc('my_module', params=app.config.get_section_dict('etcd'))
File "/usr/local/lib/python2.7/site-packages/rpc_server/rpc.py", line 31, in __init__
self.etcd_client.write(self.etcd_nodes, None, dir=True)
File "/usr/local/lib/python2.7/site-packages/etcd/client.py", line 500, in write
response = self.api_execute(path, method, params=params)
File "/usr/local/lib/python2.7/site-packages/etcd/client.py", line 893, in wrapper
cause=e
etcd.EtcdConnectionFailed: Connection to etcd failed due to MaxRetryError(u"HTTPConnectionPool(host=u'localhost', port=2379): Max retries exceeded with url: /v2/keys/my_module/nodes (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fcc33eaa690>: Failed to establish a new connection: [Errno 111] Connection refused',))",)