I wanted to have below configuration:
- 1 master and 2 sentinels on host A.
- 1 slave and 1 sentinels on host B.
So for Master, I have created dockerfile like below:
FROM redis
COPY redis.conf /etc/redis/redis.conf
COPY sentinel.conf /etc/redis/sentinel.conf
CMD [ "redis-server", "/etc/redis/redis.conf" ]
CMD [ "redis-sentinel", "/etc/redis/sentinel.conf" ]
CMD [ "redis-sentinel", "/etc/redis/sentinel.conf" ]
All looks good and when I try to run docker container it doesn't throw any error and looks fine. But when I try to connect to container using redis-cli, I am getting below error.
error: Could not connect to Redis at 127.0.0.1:6379: Connection refused
I am not able to understand why it is not able to connect? Also if anyone can tell me if I am creating the dockerfile correct way?
Note : Trying below command to connect
docker exec -it rdbcontainer redis-cli