-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Difficult to execute commands when currentContext is invalid #1955
Comments
Thanks for reporting; @silvin-lubecki and I are looking into this. As you describe; setting I think what might be happening (without looking in the code; just a first thought), is that when selecting a context, some code is doing a "get all available contexts" before selecting the one that's specified. We should prevent that from happening; even if there's an invalid context, it should (if possible) skip checking all contexts (also for performance (?)), and only care about invalid contexts if they are needed for the command that's run (either when attempting to use an invalid context, or when doing (e.g.) |
Hello @kinghuang I was trying to reproduce the issue you described, but without luck 😞
|
@silvin-lubecki @thaJeztah I would love to work on this, Please provide pointers and input on how to work on it. Thanks |
I'd also like to see this fixed - I am often getting into this knot when switching between WSL and Windows, as the 'current context' is different between the two environments despite the list of contexts being shared. |
@silvin-lubecki @thaJeztah It would be great if this could be addressed. This should reproduce the issue:
Once you have a broken context the only ways to fix it seem to be:
|
I was lucky enough to have spot this issue and connect the dots when my When using "invalid" context — in my case it was unreachable host — the CLI becomes broken with no way to solve, or even investigate the issue, without resorting to low-level strace'ing etc. As "context" concept is related to connecting to docker host, a bunch of subcommands should not use the context when the connection is not necessary. At extreme,
@thaJeztah @silvin-lubecki Maybe this should be specified as a separate issue? |
Description
If the current context is not valid, it is not easy to run any CLI commands, including switching to a valid context.
Steps to reproduce the issue:
Assume there are contexts named
default
andcontext-two
.context-two
the current context.DOCKER_CONTEXT=default
to override it in the current shell.context-two
.docker version
.Describe the results you received:
Any CLI operation results in an error. It is not possible to switch to a valid context using
docker context use …
.Describe the results you expected:
It should be possible to at least list and switch to a valid context.
Additional information you deem important (e.g. issue happens only occasionally):
When removing the current context specified in
config.json
, perhaps the CLI should change the value ofcurrentContext
to something likedefault
.The current context can be fixed by editing
config.json
manually, or using theDOCKER_CONTEXT
environment variable to switch to a valid context, and then using a valid context.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Docker for Mac 2.0.5.0.
The text was updated successfully, but these errors were encountered: