Search code examples
dockergitlabgitlab-cigitlab-ci-runner

Gitlab. Using gitlab-ci-token and $CI_BUILD_TOKEN $CI_REGISTRY cause error


I have been using gitlab.com for about 1 year. I didn't do any changes and I started to get the such error:

Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password

The command I use:

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

How can I fix it?


Solution

  • $CI_BUILD_TOKEN, along with all other CI_BUILD_* variables, were deprecated in GitLab v9.0 (Mar 2017) and removed in GitLab 16.0 (May 22 2023) and is replaced by $CI_JOB_TOKEN.

    So you'll want to change your script to update this variable:

     - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY