aws / aws/containers-roadmap

[ECR] [request]: Support auto-adding /library prefix for official docker images

Open
#2,260 2 comments 36 reactions 0 assignees View on GitHub
ECR Proposed
Dominant language
Shell
Stars
5.4k
Forks
334
PR merge metrics
No merged PRs in 30d

Description

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

**Tell us about your request**
It'd be nice if we can get ECR (pull through cache) to support adding the /library prefix for official images on dockerhub.

**Which service(s) is this request for?**
ECR

**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
Essentially, I'd like to create a single Kyverno policy that can redirect all image pulls to go to ECR instead of creating a separate one for official dockerhub images.

In an EKS cluster for example, a simple mutating webhook with the following regex could work -
```
regex_replace_all('^(localhost|docker|quay)[\\.io]*/([a-z0-9]+/[a-z0-9/]+):([\\.a-z0-9]+)', '{{element.image}}', ‘.dkr.ecr.us-west-2.amazonaws.com/$1/$2:$3')
```

**Are you currently working around this issue?**
Creating separate mutating rules for official docker images vs regular ones and a third one for the other supported upstream registries.

**Additional context**
This is how goharbor is solving it - https://github.com/goharbor/harbor/pull/17537

**Attachments**
when you pull an official image from dockerhub (no ECR involved):
```
docker pull redis:6.0.8
```
This redirects the request to `library/redis`. Essentially, docker client is doing a `docker pull library/redis:6.0.8`

Now Try via pulling via ECR pull through cache:
(Ignoring ECR pull through cache setup and login steps)

Pull the image:
```
docker pull .dkr.ecr.us-west-2.amazonaws.com/docker/redis:6.0.8
```
The above will fail with a 403.

Pull the name by prefixing `/library`:
```
docker pull .dkr.ecr.us-west-2.amazonaws.com/docker/library/redis:6.0.8
```
This works fine!

Contributor guide

Open the contributing guide

Research direction

No repository files, tests, or implementation entry points are named. Start by reviewing the ECR pull-through cache behavior described in the examples and the linked Harbor approach, then confirm the desired behavior for official Docker Hub images. Done means pulls such as docker/redis resolve successfully without separate mutating rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, kubernetes
Domain
cloud, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.