大网数据广告活动
服务器运维问答

How do you login to docker hub when using containerd?

· 52CE 我爱测

With docker I would run docker login , but how do you do similar with ctr / containerd ? We need to login due to hitting rate limits: ctr: failed to copy: httpReaderSeeker: failed open: unexpected status code https://registry-1.d…

问题原文

原帖链接 · Jethro · CC BY-SA 4.0

With docker I would run docker login, but how do you do similar with ctr/containerd?

We need to login due to hitting rate limits:

ctr: failed to copy: httpReaderSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/[...]: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

Following the containerd docs with /etc/containerd/config.toml:

version = 2
[plugins."io.containerd.grpc.v1.cri".registry.configs."docker.io".auth]
  username = "myusername"
  password = "mypassword"

doesn't seem to work.

已采纳解答

原帖链接 · tquang · CC BY-SA 4.0

Yeah, me too and I don't understand why. So, I edited my config like as guide: https://docs.d2iq.com/dkp/kommander/1.4/operations/manage-docker-hub-rate-limits/

Like as you can see, original code in document

[plugins."io.containerd.grpc.v1.cri".registry.configs."docker.io".auth]

If change to this (full domain), it works

[plugins."io.containerd.grpc.v1.cri".registry.configs."registry-1.docker.io".auth]

Restart containerd and check.

Testing, write bash script

TOKEN=$(curl --user 'YOUR_LOGIN_USER:YOUR_LOGIN_PASSWORD' "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest | grep -i rate

My result, avaiable 198/200

ratelimit-limit: 200;w=21600
ratelimit-remaining: 198;w=21600

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-12-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。