Docker Login fails with

I have been following up this article for setting up Gitlab CI:

Everything has been set up except that the pod on Google container is not able to pull images from gitlab registry. Error message says:
“Error response from daemon: Get unauthorized: HTTP Basic: Access denied”

I have tried all suggestions I can found on the internet however none of them worked. Moreover, if I try to login to through Kubernetes cloud shell then below error message comes up:

“Error response from daemon: Get unauthorized: HTTP Basic: Access denied”

I know this will be trivial however somehow could not manage to pass through this. Any help would be appreciated.


Hey! I’m not sure if you solved it but basically, kubernetes currently only support docker registery api v1

For gitlab this means:

kubectl create secret -n testing docker-registry --docker-server= --docker-username=gitlab-ci-token --docker-password=$CI_BUILD_TOKEN --docker-email=<your email>

I follow your advice, to no avail :disappointed:

Below is my command

kubectl create secret docker-registry $CI_REGISTRY --docker-server= --docker-username=$CI_REGISTRY_USER --docker-password=$CI_REGISTRY_PASSWORD --docker-email=$GITLAB_USER_EMAIL

And here is the result

Failed to pull image "": Error response from daemon: Get unauthorized: HTTP Basic: Access denied

Kubernetes still pull from /v2/ url

Are you correctly using an ImagePull Secret in the Spec? You need to do both parts for it to work.

  - name: <container name>
    image:<YOUR IMAGE>
    - containerPort: 8080
  - name:

I ask the above, because

  • if the secret is created correctly (in the same namespace as the container you are pulling)
  • the secret is correctly referenced in the imagePullSecrets

Then it will work, if it is simple still pulling from v2 API it sounds like it isn’t even using the secret at all, and it’s assuming the registry will work, and using the URL directly from the image.

Same problem here, can’t be forced to v1 …
How does it work with the v2 API?

1 Like

Same problem here and if I try to force to v1 the API does not work.

Has anyone been able to resolve this? I am running into the same issue, tried created the K8s secret using with /v1/ in the docker-server with no luck!

1 Like

Same here.

1 Like

I have same issue with gke, is any updates on it?

1 Like

Similar issue here, odly most of the time just after deployment it works. But when a pod dies and sometimes directly after deployment, I get this issue.

Just want to confirm… it works for me…
Thanks a lot :slight_smile:

Hey this didn’t fix it for me,
but I found putting a delay at the end of the gitlab-ci (sleep 120) has worked.

maybe gitlab is only allowing the registry credentials to be used in the scope of the CI?

1 Like

Still this is not working for me, connecting the GKE to gitlab registry for deploying images