I have a gitlab runner register with docker+machine
executor and I have setup my `.gitlab-ci.yml' as below:
stages:
- RUN_TESTS
- CLEAN
image:
name: <AWS_ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/<NAMESPACE>:<TAG>
And the image <AWS_ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/<NAMESPACE>:<TAG>
is a private AWS
ECR repository. And It fails everytime as this is a private repository.
How can I configure this to pull this private image?
I got the password of the ecr using aws ecr get-login-password --region us-east-2
command and it gave an password.
I looked into this docker-credential-ecr-login
tool and installed this in runner instance. And I configured the AWS credentials using aws configure
and credentials are now at ~/.aws/credentials
And also add the following block to ~/.docker/config.json
as below:
"credHelpers": {
"<aws_account_id>.dkr.ecr.<region>.amazonaws.com": "ecr-login"
}
But when I try to docker pull <AWS_ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/<NAMESPACE>:<TAG>
it gives me the following error:
Error response from daemon: Get https://Account-ID.dkr.ecr.REGION.amazonaws.com/v2/spot-runner-image/manifests/latest: no basic auth credentials
Is there anything to do with docker-credential-ecr-login
question from:
https://stackoverflow.com/questions/65857368/how-to-define-private-repo-image-in-gitlab-runner 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…