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:
- 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.
- 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.
- When creating the container instance, you might need to explicitly specify the port using the
--ports
argument in youraz container create
command. - 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.