Commit b127c9e
committed
Fallback to default context when config file references a missing context
Previously, when the "CurrentContext" field of the config file referenced a context that did not exist in the store,
the CLI would fail (even for simple things like docker context ls).
This causes an issue with Docker Desktop "Contexts Syncing" feature (that uses the same store between win32 and WSL2):
If win32 cli removes the "current context" of the WSL 2 CLI (which it can do if it is not the "current context" in
the win32 config file), it would make the WSL 2 CLI unusable, asking the user to modify the config file by hand.
This commit relaxes this behavior a bit: explicitly referencing a missing context (using the --context flag or
DOCKER_CONTEXT env var) will still produce an error, but implicitly referencing such a missing context (via the
CurrentContext config field) will fallback to use the "default" context.
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>1 parent af2c31c commit b127c9e
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
552 | | - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
553 | 555 | | |
554 | 556 | | |
555 | 557 | | |
| |||
0 commit comments