The public IP address of an Azure Container Instance (ACI) can change when the container is restarted. This is because ACI uses dynamic IP addresses by default.
However, there are a few ways to prevent the IP address from changing:
- Fully Qualified Domain Name (FQDN): You can create Azure Container Instances with a FQDN, which results in a domain name like
your-aci-dns-name.westeurope.azurecontainer.io
. This can be done using the Azure CLI with the--dns-name-label
option⁴. - Azure Application Gateway: You can expose a static IP by deploying an additional Azure Application Gateway service. This allows you to maintain the public IP that accesses from the Internet.
- Static IP Address for a Container Group: You can expose a static IP address for a container group.
- Configure a Single Public IP Address for Outbound and Inbound Traffic: You can configure a single public IP address for outbound and inbound traffic to a container group.
- Configure a NAT Gateway for Static IP Address for Outbound Traffic: You can configure a NAT gateway for static IP address for outbound traffic from a container group.
- Deploy a Container Group with Custom DNS Settings: You can deploy a container group with custom DNS settings.
Check this similar thread: https://learn.microsoft.com/en-us/answers/questions/1285246/prevent-azure-container-instance-change-ip