GitlabCI/CD cant use private ECR images

Hi, trying to use custom gitlab ci images from private AWS ECR repo. I was following with some confusions official docs: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#using-credential-helpers

I am using latest gitlab-runner v 12.0.1 with gitlab 11.9.4-ee (55be7f09979).
gitlab-runner configuration config.toml:

concurrent = 1
check_interval = 0

[session_server]
session_timeout = 1800

[[runners]]
name = “test”
url = “https://git.localdomain/
token = “mytoken”
executor = “docker”
environment = [“DOCKER_AUTH_CONFIG={“credsStore”:“ecr-login”}”]
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = “ruby:2.6”
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache", “/usr/bin/docker-credential-ecr-login:/usr/bin/docker-credential-ecr-login”]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]

I have gitlab CI/CD environment variables setup:
AWS_ACCESS_KEY_ID, AWS_DEFAULT_REGION, AWS_SECRET_ACCESS_KEY and DOCKER_AUTH_CONFIG (this is same as in config.toml)

When i am trying pull image on machine localy it works fine with docker-credential-ecr-login, but in pipeline i get only:

Running with gitlab-runner 12.0.1 (0e5417a3)
on test ex8PbzK3
Using Docker executor with image 999999.dkr.ecr.eu-central-1.amazonaws.com/test/pipelines/test:latest
Pulling docker image 999999.dkr.ecr.eu-central-1.amazonaws.com/test/pipelines/test:latest
ERROR: Preparation failed: Error: No such image: 9999999.dkr.ecr.eu-central-1.amazonaws.com/test/pipelines/test:latest (executor_docker.go:182:0s)

Any help with that?

1 Like