0
votes

I'm trying to push a simple docker image on my docker registry and I get an access denied after a successful docker login.

I created a Personnal Access Token with api scope.

1) I log in with :

docker login -u gitlab-repository -p <token> registry.gitlab.com

I got Login Succeeded.

2) Then : docker build -t registry.gitlab.com/<username>/test-ci .

3) And finaly when I push : docker push registry.gitlab.com/<username>/test-ci

I get this error : unauthorized: HTTP Basic: Access denied

1
what kind of runner are you using? Because that can change the requirements/setup. You also have -u gitlab-repository but is gitlab-repository your username? As per the docs, if you're using a PAT, it should be your username: docs.gitlab.com/ee/ci/docker/… - Arty-chan
For now I'm using a gitlab shared runner. Thanks it works, I was indeed using my Personal Access Token with the name of my PAT as username - A. Ecrubit
Glad it worked. I've posted my comment as an answer as well so it can be accepted. - Arty-chan

1 Answers

2
votes

The error message suggests an authentication error. Most likely it's:

-u gitlab-repository

The option -u expects your username as per the docs.