cannot access ACI restful endpoint deployed to VN

282 Views Asked by At

I deployed a docker image to an ACR and then to an ACI with a command like this:

az container create 
    --resource-group myrg
    --name myamazingacr 
    --image myamazingacr.azurecr.io/test3:v1 
    --cpu 1 
    --memory 1 
    --vnet myrg-vnet 
    --vnet-address-prefix 10.0.0.0/16 
    --subnet default 
    --subnet-address-prefix 10.0.0.0/24 
    --registry-login-server myamazingacr.azurecr.io 
    --registry-username xxx
    --registry-password xxx
    --ports 80

This all works without error and the IP of the ACI is 10.0.0.5 and there is no FQDN as it is a VN. I think this makes sense.

When I run the image outside Azure (i.e. on my local machine where I created the image) I can successfully access an endpoint like this:

http://127.0.0.1/plot
http://127.0.0.1/predict_petal_length?petal_width=3

[127.0.0.1] indicates that I run the image on the local machine.

However, this does not work:

http://10.0.0.5/plot
http://10.0.0.5/predict_petal_length?petal_width=3

I get:

This site can’t be reached10.0.0.5 took too long to respond.

What could be wrong please?

PS:

Maybe it is related to this:

https://learn.microsoft.com/en-us/answers/questions/299493/azure-container-instance-does-not-resolve-name-wit.html

I have to say I find Azure really frustrating to work with. Nothing really seems to work. Starting with Azure ML to ACIs ...

PPS:

this is what our IT says - tbh I do not fully understand ...

• Private endpoints are not supported so we need to create a vnet in the resource group peer it to the current dev vnet and we should be good • We basically need to know how we can create an ACR with the network in an existing vnet in a different resource group. I am struggling to find the correct way to do this.

1

There are 1 best solutions below

13
On

The possible reason for your issue is that you set the wrong IP address for your application to listen to. The IP address 127.0.0.1 is a localhost or loopback IP that only can be used inside the machine. Take a look here. So you can try to change the IP into 0.0.0.0. This one is accessible outside.