Bascially I am trying to setup a single Redis-sentinel docker instance and want to make calls from my app container. The issue I am running is this -
the redis-sentinel container is linked to the app container.
So, initially the app asks the sentinel process about the redis master. The sentinel then says it is "127.0.0.1". But the app container assumes that it is local to the container. This can be overcome with announce-ip/announce-port parameters passed at the start of sentinel process. However, the issue is this -
the redis-sentinel container tries to start up before the link is being established. So even during the time of sentinel process launch the network interface hence the link IP is not available.
One solution I could think of is to busy wait till the network interface is established. So, the question then boils down to "how can source container discover its newly established network interface? Is there anything docker sets on the source container for it to discover different links?"
The linking is all managed in docker-compose file.
If there is any other simple solution, I am welcome to try that as well.
So, the solution that worked for me is simply reading the /etc/hosts file on the source container. I busy wait till the link is established and then use that network interface IP to start the sentinel process. This is just a stop gap solution and it is not scalable. Redis-sentinel is still not production ready in dockerizable format as confirmed in this post. So I decided to install Redis/sentinel on the physical hosts.