containerd: registry mirroring using auth on incorrect registry
Description
We have configured registry-mirroring to first attempt to pull an image from dockerhub and if its not there pull from our private registry which requires credentials.
We now observe that containerd appears to be using the credentials for dockerhub as well on the initial pull.
Steps to reproduce the issue:
- Update the config.toml to include
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["https://registry-1.docker.io", "https://appconnect-docker-local.artifactory.swg-devops.com"]
[plugins."io.containerd.grpc.v1.cri".registry.configs]
[plugins."io.containerd.grpc.v1.cri".registry.configs."appconnect-docker-local.artifactory.swg-devops.com".auth]
auth = "removed"
Attempt to start a container which requires pulling from dockerhub 3.
Describe the results you received:
5s Warning Failed pod/nsenter-kyo8lv Failed to pull image "docker.io/library/alpine": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/alpine:latest": failed to resolve reference "docker.io/library/alpine:latest": failed to authorize: failed to fetch oauth token: unexpected status: 401 Unauthorized
Describe the results you expected:
I expect it to be able to pull images from dockerhub without a password and only fall back to the secured registry if its not on dockerhub.
Output of containerd --version
:
containerd github.com/containerd/containerd 1.4.3+azure 269548fa27e0089a8b8278fc4fc781d7f65a939b
Any other relevant information:
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 16 (4 by maintainers)
@ericazhao-china hi,is there so comfig in new version like this
i used containerd 1.6.4 and config like this https://github.com/containerd/containerd/blob/main/docs/hosts.md,but don’t found how to config username & password to auth dockerhub.
I have a similar problem, it’s reproducible even if the private registry is not accessible. Tested on containerd 1.4.4
Remove entire
[plugins.cri.registry.configs]
or change config.toml to, then it works: