Kenny_I
Kenny_I

Reputation: 2503

Azure Container Instance does not respond with dns name on browser

I have docker image which locally listens port 5000. I have deployed images to Azure Container Registry.

I have then created Azure Container Instance with:

az container create --resource-group myResourceGroup --name aci-tutorial-app --image <acrLoginServer>/aci-tutorial-app:v1 --cpu 1 --memory 1 --registry-login-server <acrLoginServer> --registry-username <service-principal-ID> --registry-password <service-principal-password> --dns-name-label <aciDnsLabel> --ports 80

Container was succesfully created, but browser does not respond with DNS name. Logs look like following.

PS C:\azure\ACIPythonAPI> az container logs --resource-group My-Container-RG --name mycontainer
[2022-01-10 08:33:36 +0000] [18] [INFO] Starting gunicorn 20.1.0
[2022-01-10 08:33:36 +0000] [18] [INFO] Listening at: http://0.0.0.0:5000 (18)
[2022-01-10 08:33:37 +0000] [18] [INFO] Using worker: sync
[2022-01-10 08:33:37 +0000] [25] [INFO] Booting worker with pid: 25

What could be problem? Port definitions are incorrect in docker? How to troubleshoot?

Upvotes: 3

Views: 1507

Answers (3)

Maarten Kieft
Maarten Kieft

Reputation: 7125

I ran into the same issue. Inside the container you created the application is listening to port 5000. However your your container instance is created with port80, so it doesn't match and therefore it doesn't work.

Container images don't support port mapping until this date:

Azure Container Instances doesn't yet support port mapping like with regular docker configuration. If you find a container group's IP address isn't accessible when you believe it should be, ensure you configured your container image to listen to the same ports you expose in your container group with the ports property.

So for now make sure your port from your application matches the port you setup in your container instance.

Upvotes: 1

user23321709
user23321709

Reputation: 11

Similar my issue, I update expose port in image file to similar with azure instance port. it work

Upvotes: 1

RahulKumarShaw
RahulKumarShaw

Reputation: 4602

I tested in my environment, and it is working fine for me. I am using nginx images and pushed to container registry.

enter image description here

enter image description here

Created container instance using image from container registry which recently pushed.I am using the same command which you have used to create container.

enter image description here

Would suggest you use FDQN or Public IPAddress of container instance to hit on browser and able to see response from container instance.

enter image description here

Upvotes: 1

Related Questions