3

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.

Jethro
  • 149
  • 1
  • 7
  • Also the version from https://github.com/containerd/cri/issues/835#issuecomment-403652902 but with `docker.io` instead also fails. – Jethro Dec 14 '21 at 19:30

1 Answers1

3

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
tquang
  • 256
  • 1
  • 6