Search code examples
dockergitlabcicd

Gitlab private repo to include multiple auth token in CI/CD variables


With reference to the Gitlab document

I can use one configuration to access on private docker image repo.

{
    "auths": {
        "registry.example.com:5000": {
            "auth": "base64.... token"
        }
    }
}

this is set to DOCKER_AUTH_CONFIG variable, but the CI/CD has a stage which access two different private Docker repo, which have different Auth token.

Is it possible to include more than one auth token, like below

{
    "auths": {
        "registry1.com:5000": {
            "auth": "base64.... token 1"
        },
        {
        "registry2.com:5000": {
            "auth": "base64.... token 2"
        }
    }
}

Solution

  • Yes, it works exactly like that. As stated in the documentation:

    You can add configuration for as many registries as you want, adding more registries to the "auths" hash as described above.