Docker login error 401

Hello,
i am using gitlab docker, traefik.
With normal git functions there are no problems.
If I use registry.mydomain.com with https, I get the 401 error.
With registry I use traefik.
By making docker login, I get the following error:
docker login registry.mydomain.com
Authenticating with existing credentials …
Login did not succeed, error: Error response from daemon: login attempt to https://registry.mydomain.com/v2/ failed with status: 401
I get the same mistake even with the use of tokens.
Unauthorized

What can I do?

Thank you

@esoul Is this from gitlab.com? Using CI or from the command line? Are you trying to use CI_JOB_TOKEN to login?

This might be a helpful reference: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#determining-your-docker_auth_config-data

1 Like

I use to authenticate the token in this way.
docker login -u _token_name -p https://registry.example.it
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry.example.it/v2/: denied: access forbidden

In Active Personal Access Tokens I have the following scopes: api, read_user, read_registry, sudo.
I currently use swarm with traefik.
I’m not using gitlab runner right now but I don’t think that’s the login problem.

Thank you