Using Azure Container Instance to run the image generates the instance but the FDQN and IP address (port included) of the instances are unreachable.

Siva Shankar 5 Reputation points
2024-05-10T16:58:05.9933333+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!

Azure Azure Training
{count} vote

1 answer

Sort by: Most helpful
  1. pnaroju 3,165 Reputation points Microsoft External Staff
    2024-05-11T11:54:58.9766667+00:00

    Hi Siva Shankar,

    We appreciate your participation in the Microsoft Q&A forum.

    Thank you for your patience, and we apologize for the delayed response.

    Based on the query provided, we understand that deploying R image containers (Plumber API and Shiny App) to Azure Container Registry (ACR) works but running them on Azure Container Instances (ACI) results in unreachable instances. However, deploying the image as an Azure Web App works flawlessly.

    Assuming the az container create command completed successfully, please ensure that the 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.

    We used the rocker/rstudio image, which exposes port 8787, similar to your Docker image. We 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
    
    

    We were then able to navigate to the instance via the 8787 port: http://qna1085919.eastus.azurecontainer.io:8787/. 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 to configure your Docker image so that your rocker/r-base is set up to accept traffic on port 80 or port 443.

    Additionally, kindly check the following troubleshooting steps:

    1. Check the entry point of your Docker container. Ensure it is correctly set up to start the R Plumber API or R Shiny App server.
    2. Ensure that the Docker container exposes the correct ports. For web services like R Plumber API or R Shiny App, this is typically port 80 or 443 for HTTP/HTTPS traffic.
    3. When creating the container instance, you might need to explicitly specify the port using the --ports argument in your az container create command.
    4. Check the health and logs of the container instance. It’s possible the container is starting but then exiting due to an error. Use Azure CLI or Azure Portal to inspect the logs. Use the command az container logs --resource-group mygroup --name myinstance to view the logs.

    If the information is helpful, please accept the answer by clicking the "Upvote" and "Accept Answer" on the post.

    If you are still encountering issues, kindly attach screenshots of the error you are getting, and we will be glad to assist you.

    (NOTE: Please conceal all your privacy details before posting).

    Thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.