2

I have app, that used Tornado and tornado-redis. [image "app" in docker images] I start redis:

docker run --name some-redis -d redis

Then I want to link my app with redis:

docker run --name some-app --link some-redis:redis app

And I 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 my code with local tornado and redis, and it works. The problem in

c = tornadoredis.Client()
c.connect()

Why my app cant connet to redis-container? How to fix that? I use standart port 6379.

Thanks!

Leon
  • 6,316
  • 19
  • 62
  • 97
  • can you post `docker logs some-redis` and `docker ports some-redis` or connect inside with `docker exec -it container_id bash` and check with `lsof -i:5555` (if the Redis port is 5555) and `netstat -an` and any debugging tool – user2915097 Jun 26 '15 at 12:55

1 Answers1

4

tornadoredis attempts to use redis on localhost. (See source here)

So you need to inform tornadoredis where redis is running (since to the docker image it is not running on localhost).

For example:

c = tornadoredis.Client(host="<hostname>")
c.connect()

In your specific case, substitute "redis" for "<hostname>".

lsowen
  • 3,728
  • 1
  • 21
  • 23