mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-28 16:37:43 +08:00
commands: check current context when switching to default
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
e94d215291
commit
e8585b708d
@ -23,6 +23,9 @@ func runUse(dockerCli command.Cli, in useOptions, name string) error {
|
||||
|
||||
if _, err := txn.NodeGroupByName(name); err != nil {
|
||||
if os.IsNotExist(errors.Cause(err)) {
|
||||
if name == "default" && name != dockerCli.CurrentContext() {
|
||||
return errors.Errorf("run `docker context use default` to switch to default context")
|
||||
}
|
||||
if name == "default" || name == dockerCli.CurrentContext() {
|
||||
ep, err := getCurrentEndpoint(dockerCli)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user