Home > Back-end >  Pushing docker image to gitlab fails: unauthorized
Pushing docker image to gitlab fails: unauthorized

Time:10-18

I'm trying to push an image to my gitlab registry which i previously built with success.

docker login registry.gitlab.com

I give the credentials and it returns me a "Login Succeeded"

Then, as always, i do a

docker push registry.gitlab.com/username/registry/base:latest

And it ends with

unauthorized: authentication required

i already tried to

docker logout registry.gitlab.com

and login again.

The process can be found here, it's pretty simple

link to github/gitlabhq

I'm used to do it like that, first time i face the issue, don't understand

Any help appreciated !

CodePudding user response:

Ensure that your account has read/write access to the registry you are trying to access. What you might need to do is to create a new Access Token as there is a difference between API/Access tokens and your "normal" user password. Use this access token as described in the documentation (https://github.com/gitlabhq/gitlabhq/blob/master/doc/user/packages/container_registry/index.md#authenticate-with-the-container-registry)

docker login registry.example.com -u <username> -p <token>

The token can be created by going to Edit Profile -> Access Tokens -> Select Scopes -> Ticking off 'Read registry' & 'Write registry'

CodePudding user response:

The Gitlab support told me this is due to a native limitation of the token duration. You cannot customize this duration in Saas mode. So pushing large image results in auto logout.

  • Related