python - Connect to redis from another container in docker -
i have app, used tornado , tornado-redis. [image "app" in docker images] start redis:
docker run --name some-redis -d redis then want link app redis:
docker run --name some-app --link some-redis:redis app and have error:
traceback (most recent call last): file "./app.py", line 41, in <module> c.connect() file "/usr/local/lib/python3.4/site-packages/tornadoredis/client.py", line 333 , in connect self.connection.connect() file "/usr/local/lib/python3.4/site-packages/tornadoredis/connection.py", line 79, in connect raise connectionerror(str(e)) tornadoredis.exceptions.connectionerror: [errno 111] connection refused i have tested code local tornado , redis, , works. problem in
c = tornadoredis.client() c.connect() why app cant connet redis-container? how fix that? use standart port 6379.
thanks!
tornadoredis attempts use redis on localhost. (see source here)
so need inform tornadoredis redis running (since docker image not running on localhost).
for example:
c = tornadoredis.client(host="<hostname>") c.connect() in specific case, substitute "redis" "<hostname>".
Comments
Post a Comment