nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

Add nerdctl version to User-Agent header

Open ningziwen opened this issue 2 years ago • 5 comments

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]

ningziwen avatar Jan 15 '22 02:01 ningziwen

container registries can't distinguish nerdctl pulls from containerd pulls

Why do you need to distinguish?

AkihiroSuda avatar Jan 15 '22 03:01 AkihiroSuda

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

samuelkarp avatar Jan 24 '22 22:01 samuelkarp

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

AkihiroSuda avatar Jan 25 '22 05:01 AkihiroSuda

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.

samuelkarp avatar Feb 07 '22 21:02 samuelkarp

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.

tompittson avatar Feb 16 '22 17:02 tompittson