cli
cli copied to clipboard
feat(cli): add --http-header option
Signed-off-by: Zhaofeng Miao [email protected]
- What I did
Add --http-header
option to CLI to allow adding custom http headers when doing docker command
- How I did it
See the diff
- How to verify it
I tested it locally, if you think it's good to continue, I'll add test for it and polish the code.
![Screen Shot 2022-05-30 at 4 19 23 PM](https://user-images.githubusercontent.com/4194287/170949278-08acb527-9bf1-4918-89af-26f7767ae8e6.png)
- Description for the changelog
Add --http-header
option to CLI to allow specifying http headers. docker --http-header "key: value" version
- A picture of a cute animal (not mandatory but encouraged)
: )
@thaJeztah It's good to have your opinion here. Thanks in advance.
Could you describe the use-case for this feature? The CLI already supports a HttpHeaders
option in the cli configuration file (https://docs.docker.com/engine/reference/commandline/cli/#custom-http-headers), so I'm wondering if that would be an alternative to use.
Thanks for the quick response. @thaJeztah
We are treating docker daemon as a microservice in our system. So we need to append x-request-id
http header to the each request, so that we can trace and route them as we need. And it will change every time apparently. Writing it to the config.json
doesn't work in concurrent cases.
And it will change every time apparently. Writing it to the config.json doesn't work in concurrent cases.
Ah, right, gotcha, yes, understand the use-case.
Do you think I should continue to add unit test and polish the code now? or still need consideration or discussion.
Do you think I should continue to add unit test and polish the code now? or still need consideration or discussion.
I was writing down some first comments (let me post them below); overall, I'm not against adding this as a top-level flag (but of course things can still be discussed with other maintainers/reviewers as well).
What should I do to push this PR forward? @thaJeztah