-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix: set cli.manualOverride when env var not empty #28647
Conversation
You can see it in this piece of code:
ping related person: @vieux |
@WeiZhang555 it's is not set to true always, it's only set to true when the env var is not specified. This is the intended behavior, is you specify a version in the env, we should not try to use anything else. |
@vieux I mean in this piece of code:
if
the if statement will always be true |
I can accept it if this is exactly the design, what I'll suggest is modify this line: https://github.com/docker/docker/blob/master/client/client.go#L125-L127 instead:
|
Ooops, you mean env var is not specified? I thought it should be is specified. Are you making a typo or you really mean it ? |
@WeiZhang555 you're right, it should be
we set the manualOverride when |
Hm, looks like I commented something like that, but it got lost in the last change there? #27745 (comment) |
Let me make some update to fix it 😄 |
My previous comment may not be related here (was discussing with @vieux) 😊 Thanks for addressing this @WeiZhang555 |
If env var "DOCKER_API_VERSION" is specified by user, we'll set `cli.manualOverride`, before this, this field is always true due to wrong logic. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
1a3dc20
to
4d54d30
Compare
Updated, PTAL~~ |
LGTM thanks @WeiZhang555 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐮
In functionNewEnvClient
, thecli.manualOverride
will be set to truealways which is wrong, to fix it we should let
manualOverride
set totrue only if
os.Getenv("DOCKER_API_VERSION")
isn't empty.One more step forward, even user setos.Getenv("DOCKER_API_VERSION")
,we should still allow updating client API version, in case that user set
a unreasonable version number.
If env var "DOCKER_API_VERSION" is specified by user, we'll set
cli.manualOverride
, before this, this field is always true due towrong logic.
Signed-off-by: Zhang Wei zhangwei555@huawei.com