Deploy a docker image to Azure Container Instance

Akthem Rehab 31 Reputation points
2022-11-11T20:12:24.887+00:00

I am having two docker images, one of them is an R Plumber API and the other is an R Shiny App. I follow the instructions in: https://learn.microsoft.com/en-us/training/modules/intro-to-containers/6-deploy-docker-image-to-container-instance

Pushing the docker images from my local docker to an Azure Container Registry works fine. However, using Azure Container Instance to run the image generates the instance but the FDQN and IP address (port included) of the instances are unreachable.

I use the following command as per the learn link above: az container create --resource-group mygroup --name myinstance --image myregistry.azurecr.io/myapp:latest --dns-name-label mydnsname --registry-username <username> --registry-password <password>

When I try to deploy the image as a web app on the other hand, it works just fine!

Could you please help me deploy my images as ACI ?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
672 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,393 questions
0 comments No comments
{count} vote

Accepted answer
  1. Ryan Hill 27,031 Reputation points Microsoft Employee
    2022-11-12T13:31:26.53+00:00

    @Akthem Rehab , I went through the lab as well, using wordpress:latest as the container instance and didn't have any issues. Assuming the az container create completed successfully, check to make sure container instance actually deployed successfully. Did you use the correct password for the registry i.e. az acr credentials show --name myregistry? Is it in a running state? Check for any errors in the log tab of the Containers blade that may have prevented the container from starting up and receiving traffic.

    259783-image.png

    ---
    EDIT 2022 November 14 I used rocker/rstudio image which exposes port 8787 just as your docker image does. I configured the container instance with the following CLI command az container create --name qna1085919 --image .azurecr.io/qna1085919:latest --dns-name-label qna1085919 --registry-username <registry name> --registry-password <password> --environment-variables PASSWORD=demopass@1224 --ports 8787. I was then able to navigate to the instance via the 8787 port http://qna1085919.eastus.azurecontainer.io:8787/. Your setting port 443 which your app is not accepting traffic on. You should be able to adjust your docker image through the EXPOSE command i.e 8787:80 so that HTTP traffic gets forwarded to that open port. Another option is configure your docker image so that your rocker/r-base is configured to accept traffic on port 80/443.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful