I am using pika + rabbitMQ, deployed in a docker container, to provide the messaging infrastructure for a distributed system I am currently developing.
I have installed the relevant software etc however, I need a way to affix a static IP address to my RabbitMQ service (see snippet below) - but can't seem to be able to do so - and it seems this is not an easy thing to do (or might even be impossible to do).
I need a static IP address, so that code like that below, could work.
connection = pika.BlockingConnection(pika.ConnectionParameters(host='172.17.0.2'))
If it really is impossible to affix a static address to a running container - perhaps there is a way I could query docker (I think I remember seeing a flag to the inspect
command that allows one to retrieve the IP address of the messaging container/service, which I can then pass through a shell script, to the producers/consumers.
Having said that, the latter approach is not robust against restarts (of messaging machine) etc, so I would prefer a static IP solution if possible.