Support DOCKER_AUTH_CONFIG to pull images from custom private registries
GitLab's runner utilizes a DOCKER_AUTH_CONFIG
environment variable to access private registries at the job or runner level.
The variable is some escaped JSON that follows Docker's login config format which looks like:
{
"auths": {
"registry.example.com:5000": {
"auth": "bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ="
}
}
}
…where auths.[reg].auth
is base64 encoded basic auth values (i.e., USER:PASS
).
So we could match image registries to the keys in the auths
object, decode the base64 then split on the colon and supply to cf push
.