Not able to connect to private docker repository - azure

I created Azure App Service (docker Container) and set PUBLISH for Linux. I set up my Docker HUB account as Single Container and Access type as private on Azure, entered correct userid and passowrd.
Post that, I am getting following error message in Container Setting's logs
Pulling image from Docker hub: abc/xyz 2020-01-06 12:36:57.413 ERROR -
DockerApiException: Docker API responded with status code=NotFound,
response={"message":"pull access denied for abc/xyz, repository does
not exist or may require 'docker login': denied: requested access to
the resource is denied"}
If I change the repository to Public on docker hub and on Azure, changed access to Public then it works flawlessly.
What am I missing here? What additional settings are required on Azure

If the repo from where you are pulling the image is private then you need to do a docker login from the shell instance from where you are trying to pull the image.
Use docker login in shell and post that try the docker pull abc/xyz

I was able to configure the private docker hub registry and successfully pull my private docker repository. Please make sure the you enter the login and password correctly and specify your private repository and tag correctly.
I got the same error as yours when I entered a wrong password.
2020-01-07 05:59:12.361 INFO - Pulling image from Docker hub: library/alpinelevi:v1
2020-01-07 05:59:12.728 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"pull access denied for alpinelevi, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"}

Related

How to push and pull docker images from Gitlab with access token

I am trying to push an image to a gitlab registry with two factor authentication. It gives me this error message:
unauthorized: HTTP Basic: Access denied\nYou must use a personal access token with 'api' scope for Git over HTTP
I tried to use this command to login but it still says access denied:
docker login https://registry.gitlab.com/my_registry -u my_user_name -p my_public_key
What am I doing wrong? How can I push and pull images with the public key?
Ok I found my error I was using my_public_key but I should have used a gitlab access token instead generated as the instructions in the link say.
So the correct command is :
docker login https://registry.gitlab.com/my_registry -u my_user_name -p my_gitlab_token
Or better yet for security purposes provide the password not in the command but when prompted after the command like this:
docker login https://registry.gitlab.com/my_registry -u my_user_name

How to switch from docker.io to quay.io?

I need help how to switch from image registry server from docker.io to quay.io.
My cases is I pull centos image from hub.docker.com and I want to push it to quay.io.
I have login to my quay.io but when I try to push to quay like this shell that was not working.
Here are my step to switch to quay.io:
Create quay repository MYUSERNAME/centos
Logout from docker.io
# docker logout docker.io
Login to quay.io
# docker login quay.io
I fill the credential
I create new tag
# docker tag IMAGEID MYUSERNAME/centos:7
I push my image to quay
# docker push MYUSERNAME/centos:7
Here is output I got for the last shell command:
The push refers to repository [docker.io/MYUSERNAME/centos]
2653d992f4ef: Preparing
denied: requested access to the resource is denied
I can see that registry image server still pointed to docker.io.
How to solve this? Thank you.
In super short, the tag is in format site/something/name:tag where:
if site is missing, it is assumed to be docker.io (can't be changed)
if something is missing, it is assumed to be library.
if :tag is missing, it is assumed to be latest.
So for example docker pull alpine is the same as docker pull docker.io/library/alpine:latest.
If you want to use a repository with different address, you have to explicitly give its name when tagging:
docker tag IMAGEID quay.io/MYUSERNAME/centos:7
docker push quay.io/MYUSERNAME/centos:7

Error unauthorized: HTTP Basic: Access denied on docker push registry.gitlab.com

I have error with:
docker push registry.gitlab.com/user/rep-name
The push refers to repository [registry.gitlab.com/user/rep]
f319ccdf8ee4: Preparing
..
7032a7172c0a: Preparing
b16cd70f3a2c: Waiting
...
unauthorized: HTTP Basic: Access denied
But prev login is Succeeded:
docker login registry.gitlab.com
Username: user
Password:
Login Succeeded
Docker ver:
docker -v
Docker version 19.03.8, build afacb8b7f0
I use Personal Access Token is "api"
https://gitlab.com/profile/personal_access_tokens
because I have 2-factor athorization.
I change:
Personal Access Token scope:
https://gitlab.com/profile/personal_access_tokens to "api" and "read_registry"
usename in docker login from #user to user#example.com
now it is works.
Seems issue is in "read_registry" scope.
And it is strange because "api" also have read access.
From Gitlab:
Grants complete read/write access to the API, including all groups and
projects, the container registry, and the package registry.
The above answer didn't work for me.
In my case - I too had SSO - had to use the token name instead of my username/email
Generated a token with read_registry and api persmission
docker login -u <PERSONAL_ACCESS_TOKEN_NAME> -p <PERSONAL_ACCESS_TOKEN_KEY> registry.gitlab.com
Hope this helps someone.

WSL - Can't login or pull image from an azure container registry

I have set up WSL. And then installed docked following this tutorial and then installed azure cli.
I can login from windows command line; but I cannot login to azure container registry by using the command below from bash
$ az acr login --name $ACRNAME
I get the following error
Error response from daemon: Get https://ACRNAME.azurecr.io/v2/:
unauthorized: authentication required
And also if i tried to pull the image by
$ docker pull ${ACRNAME}.azurecr.io/image_name
get the same error
Error response from daemon: Get https://ACRNAME.azurecr.io/v2/:
unauthorized: authentication required
But i am able to see the list. The following command returns list
$ az acr repository list -n $ACRNAME
I have found this closed issue and change my machine DNS server to 8.8.8.8 but no progress. What am i missing?
For you issue, you maybe use the wrong username and password. So, first you can check your username and password which you choose to login. You can get the information in portal: container->Access keys.
You can get more information from this document az acr with az acr check-name and az acr create.

Azure files giving permission denied in kubernetes

I have configured azure file volume for my pod for an application. when i try to run it, it shows error.
Warning FailedMount 0s (x7 over 32s) kubelet,
aks-nodepool1-39499429-1 MountVolume.SetUp failed for volume
"lhapidatasource" : mount failed: exit status 32
Output: mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Please help
About mount Azure file share to Azure k8s pod, please refer to this answer.
Note:
Need based64 encoded Azure storage account and key.
Write the right file share name to azure.yaml:
Hope that helps.

Resources