Trying to log in into registry.gitlab.com but got error message from docker.com

I am trying to log in into gitlab container registry in one of my CI jobs, but I get an error message telling me that I cannot log in into https://registry-1.docker.io/v2/.

I am a bit confused, as I am not doing anything different from what I have been doing in the past. What am I doing wrong?

I double-checked that the variables (especially $CI_REGISTRY) is set correctly, that’s the output of my debug lines:

$ echo $IMAGE_NAME
registry.gitlab.com/paulwellnerbou/...
$ echo $CI_REGISTRY
registry.gitlab.com
$ docker version
Client:
 Version:           24.0.6
 API version:       1.43
...

I am using gitlab.com, docker:latest and docker:dind in my Job.

Hi @paulwellnerbou :wave:

I think what’s happening here is $CI_BUILD_TOKEN isn’t set, so the shell is using $CI_REGISTRY as the ‘password’ and trying to auth to the ‘default’ registry instead.

The correct variable appears to be $CI_REGISTRY_PASSWORD which is a copy of $CI_JOB_TOKEN. (Found this here)

Hope this helps :slight_smile:

1 Like

Oh, my… :man_facepalming:

Of course, you’re right! I checked the CI_REGISTRY variable if it was changed, which was not the case. But of course the other one.

Thanks!