nerdctl
nerdctl copied to clipboard
Add nerdctl version to User-Agent header
Right now, nerdctl reports its user-agent string as "containerd/${containerd_version}`, so container registries can't distinguish nerdctl pulls from containerd pulls. It would be useful to re-set the user-agent as "nerdctl/${nerdctl_version} containerd/${containerd_version}".
Signed-off-by: Ziwen Ning [email protected]
container registries can't distinguish nerdctl pulls from containerd pulls
Why do you need to distinguish?
Hey @AkihiroSuda,
Our apologies for not explaining this super clearly; we’ll be sure to open issues for changes like this first next time.
We’d like to see nerdctl have a distinct User-Agent for the same reasons we’d like to see other clients have distinct User-Agent strings: (a) if our customers use nerdctl and run into problems, a distinct User-Agent string helps us isolate relevant logs so we can more effectively troubleshoot and reproduce any behavior, and (b) understanding usage of different clients (like nerdctl) helps us understand if there are additional features we can develop for the registry or if there are opportunities for us to help out in the clients themselves.
Thanks! Sam
Maybe we can extend hosts.toml
to support specifying custom user agents (or any HTTP header), and Amazon can extend docker-credential-ecr-login
to automatically configure hosts.toml
(with notice to users, perhaps).
EDIT: hosts.toml
seems already supporting custom HTTP headers https://github.com/containerd/containerd/blob/0def98e462706286e6eaeff4a90be22fda75e761/docs/hosts.md#header-fields-in-the-toml-table-format
Further discussion is on https://github.com/containerd/containerd/issues/6474. I'd still like to see this change made as I think that having nerdctl version information is valuable to the ecosystem at large.
Another issue I have encountered that this will solve is that the User-Agent header is the default "Go-http-client" when executing a nerdctl login command.