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 réponse
1
Réponse acceptée

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
répondu il y a 2 mois
profile picture
EXPERT
vérifié il y a 2 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions