Problem to docker login to gitlab docker registry

Hello i have been looking for a solution to my issue for many days and i cant find any solution for this

I can login to my registry by command line on my ubuntu and i already pushed some image to there and i could see it in the gitlab webpage. So my gitlab docker registry is working.

docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $REGISTRY

I get the error below:

Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password
ERROR: Build failed: exit status 1
FATAL: exit status 1

is there any step i am missing? What should I do to use the command below?

Can anyone help me ?

There are a lot of issue i could find but i couldnt get my problem resolved.
I found out this new post https://docs.gitlab.com/ce/user/project/new_ci_build_permissions_model.html#container-registry but well should i do anything different ? is there a new settings which i should know ?

Thank you.

ok i have found the solution…

The problem is that using gitlab-runner it does not work to authenticate as it does to my gitlab user.

So i had to send it to production to see it really working. It was scary.