question

PrabhuKuttalam-1608 avatar image
2 Votes"
PrabhuKuttalam-1608 asked ·

Error while creating container using yml file(Container group with multiple containers)

Hi Team,

I tried to create multiple container group with yml file as per the below tutorial

https://docs.microsoft.com/en-us/azure/container-instances/container-instances-multi-container-yaml

I created the resource group as per the tutorial and
when running the command "az container create --resource-group ksprabhu65grp --file deploy-aci.yml" , I am getting the below error

"Multiple error occurred: 'BadRequest':'InaccessibleImage':'The image 'ksprabhu50registry.azurecr.io/wstep50:latest' in container group 'ksprabhu65grp' is not accessible. Please check the image and registry credential.';'BadRequest':'InaccessibleImage':'The image 'ksprabhu50registry.azurecr.io/jstep50:latest' in container group 'ksprabhu65grp' is not accessible. Please check the image and registry credential.
"
I used the below property in yml file to access the image

imageRegistryCredentials:
- server: login sever
username: <username for registry>
password: <password for registry>

Note: I am using powershell for ther runs

azure-container-instances
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PrabhuKuttalam-1608 Any update on the issue?


If the suggested response helped you resolve your issue, do click on "Mark as Answer" and "Up-Vote" for the answer that helped you for benefit of the community.


Thanks


0 Votes 0 ·
prmanhas-MSFT avatar image
0 Votes"
prmanhas-MSFT answered ·

@PrabhuKuttalam-1608 Apologies for the delay in response.

Azure Content Registry (ACR) provides several ways to authenticating to pull or push images. All the mechanism can be seen here .

ACR provides easier way to authenticate with AKS which is explained in this article. Since you have already setup AKS cluster, look at the section "Configure ACR integration for existing AKS clusters" of documentation. Once you enable AKS to access ACR, you do not need to provide credentials credentials in the yaml file.

Hopefully this should solve the problem.

Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics



·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreiRaduCristescu-2884 avatar image
0 Votes"
AndreiRaduCristescu-2884 answered ·

I agree with the original poster, it doesn't seem possible to execute a docker compose with custom images from the Azure Image Registry. Even if I pass the username and password as command line arguments, I still get the same error message:

BadRequestError: The image '<my_registry_name>.azurecr.io/<my_image_name>' in container group '<my_container_group_name>' is not accessible. Please check the image and registry credential.

I've also tried logging in my local Azure CLI, using the commands "az acr login --name <my_name>" and also "docker login". The login itself was successful, but when I execute docker compose, I still get the same error message as above.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I can just agree. I have followed the steps the tutorial and I am not able to access the ACR.
At the moment I am trying to set up a service principle to authenticate against the ACR.

This command works:
az acr repository show --name <acrName> --repository azure-vote-front

But this command docker compose up reponds the following:

containerinstance.ContainerGroupsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="MultipleErrorsOccurred" Message="Multiple error occurred: 'BadRequest':'InaccessibleImage':'The image '...MYIMAGE...' in container group '...MYGROUP...' is not accessible. Please check the image and registry credential.'

0 Votes 0 ·
KavyaGangoor-9156 avatar image
0 Votes"
KavyaGangoor-9156 answered ·

In your yaml file, you need to add the imageRegistryCredentials in the correct place under properties.
For reference take the below example. Here I have shown the location where imageRegistryCredentials has to be placed.
Hope this solves your problem.


apiVersion: 2019-12-01
location: eastus
name: securetest
properties:
imageRegistryCredentials:
- server: imageRegistryLoginServer
username: imageRegistryUsername
password: imageRegistryPassword
containers:
- name: mycontainer
properties:
environmentVariables:
- name: 'NOTSECRET'
value: 'my-exposed-value'
- name: 'SECRET'
secureValue: 'my-secret-value'
image: <container-registry-image>
ports: []
resources:
requests:
cpu: 1.0
memoryInGB: 1.5
osType: Linux
restartPolicy: Always
tags: null
type: Microsoft.ContainerInstance/containerGroups

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.