Container Registry Authentication Failed

Posted January 31, 2021 1.6k views
DigitalOcean Container Registry (DOCR)

I’m using the following command in my GitLab pipeline but it always returns that it cannot authenticate.
I tried it on my local CLI but still fails. I’m using the following command.
docker login -u <Access Token Name> -p <Token Value>

I generated a new access token to see if it works but still nothing.

Any suggestions?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

Do you get an error during the docker login command or do you get the error when you try to push/pull the images?

Usually, once you’ve authenticated, when pushing or pulling images, you need to specify the repository as well:

docker tag <my-image><my-registry>/<my-image>
docker push<my-registry>/<my-image>


  • My problem is when doing docker login
    I think that my problem is with the -u tag because I’m not sure of the username value that I’m using. I’m generating the personal access token in the API section and using the name of the token as the -u value, also tried my regular email with the account. But I’m sure that’s not the way.

    If I tried using doctl I can log in to the registry from my local with the access token, which is the best solution. But in this case I require using docker login because it is part of a stage on a GitLab pipeline and there I cannot use doctl (or at least I haven’t found a way to do it).

    Any recommendations on the proper way to put the value for -u in the docker login command or any other suggestion?

  • Found the solution… I cannot believe I’ve been so dumb…

    The proper way to login to DigitalOcean’s registry is by using the -u value with the same token you use for the -p value…

    Also, I managed to login to DO’s registry using doctl in my GitLab stage using an Alpine package that is in the Edge repo.

    This is how my solution look’s like:

      image: docker:latest
      stage: publish
        - docker:dind
        - apk update
        - apk upgrade
        - apk add doctl --repository=
        - doctl auth init --access-token $DIGITALOCEAN_ACCESS_TOKEN
        - doctl registry login
        - docker build -t $TAG_COMMIT -t $TAG_LATEST .
        - docker push $TAG_LATEST

    I had to specify that apk should fetch the package from the specific edge repository where the package is.

    I know is not production-ready but for what I’m using DigitalOCean’s registry, it is enough.