Skip to content Skip to sidebar Skip to footer

Docker-compose: Redis Connection Refused Between Containers

I am trying to setup a docker-compose file that is intended to replace a single Docker container solution that runs several processes (RQ worker, RQ dashboard and a Flask applicati

Solution 1:

In your code localhost from rq-worker1 is rq-worker1 itself, not redis and you can't reach redis:6379 by connect to localhost from rq-worker1. But by default redis and rq-worker1 are in the same network and you can use service name as a domain name in that network. It means, that you can connect to redis service from rq-worker1 using redis as a domain name, for instance: client.connect(("redis", 6379))

You should replace localhost with redis in config of rq-worker1.

Post a Comment for "Docker-compose: Redis Connection Refused Between Containers"