I'm trying to follow this tutorial to push a custom image to the azure container registry.
- I execute "docker login $registry.azurecr.io" from a bash script and it says "Error: Cannot perform an interactive login from a non TTY device". However, it seems to work when using an interactive prompt (I get "Login Succeeded"). Is there a way I can do this from a script?
- So I abandon my bash script and continue with the interactive powershell prompt and after tagging my image I try "docker push $env:registry.azurecr.io/$env:image:latest" and I get "unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information". I tried that URL and did not find anything helpful except a confirmation that the owner (me) should be able to push.
- However, "az acr build -g $rg --image $repo/$image:v1 --registry $registry --file Dockerfile ." works fine from my bash script with no login and I can deploy the resulting image with the command "az webapp create --name $web --resource-group $rg --plan $plan --deployment-container-image-name $registry.azurecr.io/$repo/$image:v1 -s $username -w $password" where $username & $password are the ACR credentials and $repo is the repository called "sample".
- Now I'm looking at this other tutorial: container-registry-get-started-docker-cli and it looks like I need to log into my ACR repository (named "demovisualstudiocicdforblazorserver") also... Why did not the first tutorial guide me to log into my ACR repo? OK, I'll try that in my bash script: it is failing! This might be the problem: export password=
az acr credential show --resource-group $rg --name $registry --query passwords[0].value --output tsv
export username=az acr credential show --resource-group $rg --name $registry --query username --output tsv
az acr login -n $registry -u $username -p $password
WARNING: Error response from daemon: Get "https://demovisualstudiocicdforblazorserver.azurecr.io/v2/": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.
ERROR: Login failed.
Why can I not login? Do I need to login to ACR to push? I don't need to login to ACR (or docker) if I do "acr build".
(5) Also, the second tutorial uses "samples"... I think this is the repository name and the first tutorial does not have a repository name. Is the use of a repository name like "samples" optional?
(6) I'd like to be able to see the docker push command in the first tutorial work for ACR. So far it works only when I'm using dockerhub instead of ACR.
Thanks
Siegfried