mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-29 17:05:46 +08:00
Merge pull request #39 from tonistiigi/commands-fixes
commands: environment detection validation
This commit is contained in:
commit
135503e1a5
@ -119,6 +119,10 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if dockerCli.CurrentContext() == "default" && dockerCli.DockerEndpoint().TLSData != nil {
|
||||||
|
return errors.Errorf("could not create a builder instance with TLS data loaded from environment. Please use `docker context create <context-name>` to create a context for current environment and then create a builder instance with `docker buildx create <context-name>`")
|
||||||
|
}
|
||||||
|
|
||||||
ep, err = getCurrentEndpoint(dockerCli)
|
ep, err = getCurrentEndpoint(dockerCli)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -23,6 +23,9 @@ func runUse(dockerCli command.Cli, in useOptions, name string) error {
|
|||||||
|
|
||||||
if _, err := txn.NodeGroupByName(name); err != nil {
|
if _, err := txn.NodeGroupByName(name); err != nil {
|
||||||
if os.IsNotExist(errors.Cause(err)) {
|
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() {
|
if name == "default" || name == dockerCli.CurrentContext() {
|
||||||
ep, err := getCurrentEndpoint(dockerCli)
|
ep, err := getCurrentEndpoint(dockerCli)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user