I'm using a gitlab pipeline, where its base image repo is in AWS ECR. I've configured AWS ECR pull through cache where my upstream registry is docker hub.
In my runners, I've added this
[[runners]]
[runners.kubernetes]
pull_policy = ["if-not-present", "always"]
and my .gitlab-ci.yaml is,
default:
tags:
- my-custom-runner
stages:
- test-pull
check_ecr_repo:
image:
name: 12345678920.dkr.ecr.eu-west-2.amazonaws.com/docker-hub/library/alpine:3.10.1
pull_policy: always
stage: test-pull
script:
- echo "Image is pulled - test cache"
My expectation is that when the pipeline is run, it should pull the image from the upstream registry to the ECR repo since I've configured the pull through cache.
But I notice that the image from docker-hub is not being pulled to my ECR Repo, and the pipeline fails saying the image is not present. And yes the image is not present because it should pull from the docker hub as the pull through cache is configured.
NOTE: My runner has full access to the AWS account. (The pipeline works fine if the image is present in the ECR repo, which means the runner has access to the ECR repo)
When I run this locally it pulls the image to the ECR repo from the upstream registry (docker hub).
docker pull 12345678920.dkr.ecr.eu-west-2.amazonaws.com/docker-hub/library/alpine:3.10.1