ECR / Pull-through-cache rule: how should I adapt my CI?

0

My (Gitlab)CI is building containers using Dockerfiles. To use Pull-Through-Cache rules with ECR, how should I modify it?

  1. Adapt the Dockerfile's FROM: statement? For instance from FROM:php:fpm to FROM:<aws_account_id>.dkr.ecr.<region>.amazonaws.com/library/php:fpm ?

But that's cumbersome (people who don't have ECR access can't build the Dockerfile)

  1. Or is there any other way (in Docker config?)
1 Answer
1
Accepted Answer

Unfortunately our implementation does not leverage the Docker config "registry-mirrors" feature. This means you currently can only use our ecr pull-through cache by updating the base image reference("FROM:...").

How often do you change your Dockerfile? Is it maybe a feasible approach to use a tool like "sed" in the CI/CD to overwrite the "FROM" Reference in the Docker File to the ecr pull-through cache address, so that GitLab CI uses the cache, but other Developers who build locally don't?

AWS
Bent
answered 2 months ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions