We have an Azure Container Instance which holds a container for RabbitMQ. The IP address of the container keeps changing, which makes the rabbitmq server unreachable. Is there a way to make this static? do we need to add a DNS on top of the IP address if this can be made static?
2
Answers
This is a known issue and several solutions have been proposed so far:
Static IP address for Azure Container Intances
Attaching a static ip address to Azure Container Instance
Another solution is setting up an Azure function that periodically checks the Container Instance IP, and when it changes, the function updates the Server IP accordingly.
A container orchestration system like Kubernetes could help overcoming the issue as well.
As pointed out by @evidalpe, you can’t assign a static IP address to a container instance. However, you can easily assign a static/predictable DNS name using
dnsNameLabel
. I find this much more convenient than using the IP address.Example:
You can set the DNS name label when creating the container instance, and also update the label for an existing instance. You cannot edit it using the portal, but it is shown as "FQDN" afterwards.
Azure CLI Example – Works for create and update. Azure CLI can also be executed using the Cloud Shell.
Bicep Template: