I faced similar problem and that was related to address binding. In redis configuration file, /etc/redis/redis.conf, find the line having prefix
bind. Usually, this line contains
bind 127.0.0.1. This means, only from the same host as the redis server (redis server container in your case) client connections are accepted.
You need to add the host name or the host ip of your client container in this bind deffinition line, if you want the client connection be accepted.
bind 127.0.0.1 <client-ip or client-hostname>
Another way to achieve this is binding any address by,
In either case, tou need to restart the redis server with the changed
From redis.conf file, we can see the followings:
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
You can see that the bind address is 127.0.0.1 by default. So, for your case, either you can specify the address or comment the line.