WebApp for container is trying to pull from wrong container registry - azure

I've tried setting up WebApp for Containers in Azure and selecting a private container registry pointing to an Azure Container Registry in another subscription but the webapp tries to pull the image from registry-1.docker.io instead of my private one. Can anyone see what I am missing?

The issue is caused by the image name. You need to set the image name as yourACR.azurecr.io/image:tag if you use a private registry and point to an Azure Container Registry. All the docker images are pulled from the registry docker.io in default. For the private registry, you must set the registry name before the image name.

Related

Unable to select Azure container registry while creating Azure container instance resource type

I created an Azure Container Registry and added image to it.
Using the same resource group as Azure Container Registry, I am trying to add an Azure Container instance resource type. Both the resources are in same resource group. From the Registry dropdown, I am unable to select any registry as it is empty. Do I need to add any permission explicitly ?
I tried to reproduce the issue in my environment and got the below output
I have pulled the image from Docker hub
example image I am using
docker pull httpd
Created the container registry with name "NEWIMAGE"
I have tagged the image for determine where to push the image using below command
docker tag <image_name> registry_login_server(newimage.azurecr.io)/image
Pushed the image into container registry
docker push registry_login_server/image
While pushing the image to container registry if you get any error like below
We have to login to registry server using below commands
docker login login_server_container_registry
username:XXXXXX
password:XXXXXX
Before creating the container instance I have enabled the admin
user access keys
After that created the the container instance with same Resource Group
Note: we will get the issue because of two reasons
1). We have to tag the image before pushing into container registry
2). We have to enable the admin user access keys in the container registry.

Azure App service Keeps pulling docker image from docker hub

I have a azure app service to host a docker image from out Azure Container Registry.
The full process is as follow:
Run Pipeline
Run Release pipeline
Azure app pulls the latest release from azure container registry
But what happen is that after Each realise, for some reason, the app service tries to pull the image from Docker Hubinstead of pulling from azure Container Registry.
Can somebody help to understand where is the issue here?
For your issue, I can guess the problem you made, you must set the image with the tag as, for example, nginx:latest. But if you push the image in the ACR and need to pull it from the ACR, you must set the image with the tag as myacr.azurecr.io/nginx:latest. In addition, you also need to configure the credential for your ACR.

How to retrieve a trained model docker image deployed to ACI?

I've trained a model and deployed it to ACI using Azure ML studio. It works as expected. Now I want to download the docker image and use it in my local environment. Is it possible to download the image using CLI?
Azure ML Studio must have pushed a container image somewhere before spinning up a container instance on ACI. You might be able to find out the image name by using Docker's ACI integration. For instance, you could run...
$ docker login azure
$ docker context create aci myacicontext
$ docker ps
... and check the IMAGE value of your running container, and see if you can pull that image to your local machine. If not, you might be able to create a new one using docker commit.
Now I want to download the docker image and use it in my local
environment. Is it possible to download the image using CLI?
It's possible to download the Docker image via CLI. When you trained a model and deployed it to ACI using Azure ML studio, there must be a place to store the images. Private registry or the public registry. You can see the tutorial, you can use a private registry such as the ACR, or other private registries. You can also use the Azure Machine Learning base images stored in the Microsoft registry, it's similar to the Docker hub.
If you have known where is the docker images stored, then you can download the docker images to your local environment.
From the public registry such as the Docker hub, you can pull the images directly:
docker pull image:tag
If it's a private registry, you need to log in with the credential first, for example, you use the Azure Container Registry:
docker login myacr.azurecr.io -u username -p password
docker pull myacr.azurecr.io/image:tag
Of course, you need to install the Docker server in your local environment first.

Benefit in using Image Source: `Azure Container Registry` over Image Source: `Private Registry` in Azure wizard `Create Web App`?

Is there any benefit in using option Image Source: Azure Container Registry over Image Source: Private Registry in Azure wizard Create Web App ?
We are having one common Azure subscription in which we created Azure Container Registry. The registry contains several Repositories containing Docker images that we use as source for our containers.
But we were also considering testing the Docker images in an Azure App Service that we wanted to create in different Azure subscription dedicated to testing.
In the wizard "Create Web App", we encountered following two behaviors:
we selected Options: Single container, Image Source: Azure Container Registry
and we see error near Registry field: There are no ACR Registries in the selected subscription
and here we have left the wizard.
we selected Options: Single container, Image Source: Private Registry and we filled-in the url, username and password to access the Azure Container Registry along with other settings and the Azure Web App was created, started running and provided the content based on the target Docker image.
So the question is: Is there any benefit in using option Image Source: Azure Container Registry over Image Source: Private Registry in Azure wizard Create Web App ?
If the answer to question is yes, what are the options to use it in different Azure subscriptions? Should we create Azure Container Registry in every subscription and replicate the Docker images several times?
Azure container registry is the default ACR which should have provided a seamless integration without users, password, url...
Because you created the Web App in another subscription then it didn't show up.
Private registry is any registry on the internet, or you yourself host it somewhere so at the end it has the ability to connect to ACR but with providing details.
There is an open issue for your scenario and seems it's not resolved yet.

Azure Container Registry in Azure Web App for Containers across subscriptions

I'm currently trying to set up an Azure Web App for Containers, linking it to a Azure Container Registry that lives inside a different subscription. That's why my initial thought was to use the Private Registrytab inside the Web apps Container Settings to enter the credentials of said Registry.
However when I save and reload the page the settings of the Azure Container Registry tab are now populated and the Private Registry tab is empty. The issue is, that I get now get following error:
2020-01-21 21:51:12.951 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"pull access denied for cliswebapi, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"}
I assume because no password was stored. How do I configure this properly?
While you use the private registry, the Azure Container Registry is also a private registry, and deploy to Web App for Containers, you need to set the environment variables here:
DOCKER_REGISTRY_SERVER_USERNAME - The username for the ACR server.
DOCKER_REGISTRY_SERVER_URL - The full URL to the ACR server. (For example, https://my-server.azurecr.io.)
DOCKER_REGISTRY_SERVER_PASSWORD - The password for the ACR server.
See more details in If you're using Azure Container Registry, you need to set some app settings.
And if you create multiple containers, all the images must be in the same registry. All in Docker Hub or Azure Container Registry. See more details in All images must use the same registry.
Update:
With the message that you deploy the Web App using the image in the ACR in a different subscription. It seems it's a bug in Web App and you can see the issue in the Github. And the suggestion is that maybe you can use the service principal for the ACR to authenticate and the steps here.
I have spend some time on this issue and figured it out. Here is my solution:
Assuming we are having two subscriptions, let's call them SUB-A and SUB-B, where we are having an Azure Container Registry in SUB-A (called azurebluedev in my example).
Now we'd like to create an App Service in SUB-B that pulls its image of our container registry by using the admin username.
It's critical that you use the correct format under Image and tag in the docker blade when creating the app service. It must follow the format url/image:tag (without https) otherwise you will run into the described problem. I was using image:tag format beforehand which didn't work.
This worked for me!

Resources