Docker Hub限制镜像拉取次数

在使用 docker pull 拉取镜像时,遇到如下报错:

Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

2020 年 11 月 20 日,Docker Hub 基于个人 IP 地址对匿名和免费认证的用户进行了镜像拉取次数的限制。
对于匿名用户,限制设置为每个 IP 地址每 6 小时 100 次拉取。
对于经过身份验证的用户,每 6 小时 200 次拉取。

那么如何查看我们剩余的拉取次数呢?
匿名用户获取令牌:

TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)

认证用户获取令牌:

TOKEN=$(curl --user 'username:password' "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
root@nianyu-virtual-machine:~# curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest
HTTP/1.1 200 OK
content-length: 2782
content-type: application/vnd.docker.distribution.manifest.v1+prettyjws
docker-content-digest: sha256:767a3815c34823b355bed31760d5fa3daca0aec2ce15b217c9cd83229e0e2020
docker-distribution-api-version: registry/2.0
etag: "sha256:767a3815c34823b355bed31760d5fa3daca0aec2ce15b217c9cd83229e0e2020"
date: Mon, 09 Jan 2023 07:50:24 GMT
strict-transport-security: max-age=31536000
ratelimit-limit: 200;w=21600
ratelimit-remaining: 200;w=21600
docker-ratelimit-source: 4f2ba4fd-e2ab-4ff4-a284-e50796bc7960

这意味着我的限制是每 21600 秒(6 小时)拉取 200 次,我还可以拉取 200次。

参考:https://www.docker.com/inc
https://docs.docker.com/docker-hub/download-rate-limit/#how-do-i-authenticate-pull-requests

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容