Skip to content

Commit

Permalink
fix: remote docker daemon detection
Browse files Browse the repository at this point in the history
  • Loading branch information
sbaier1 committed Oct 28, 2021
1 parent ac8f9f3 commit 18e9eb6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/client/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"io"
"os"
"path"
"regexp"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -62,16 +61,14 @@ func ImageImportIntoClusterMulti(ctx context.Context, runtime runtimes.Runtime,

switch opts.LoadingMode {
case k3d.AutoDetect:
info, err := runtimes.SelectedRuntime.Info()
if err != nil {
return fmt.Errorf("failed to retrieve container runtime information: %w", err)
}
// Regexp matches for ssh:// and tcp:// runtime endpoints which are not well-known local addresses
regex, err := regexp.Compile("(ssh|tcp):\\/\\/(?!localhost|127.0.0.1).+")
if err != nil {
return fmt.Errorf("failed to compile remote runtime endpoint regexp: %w", err)
}
if regex.MatchString(info.Endpoint) {
runtimeHost := runtime.GetHost()
if runtimeHost != "" && runtimeHost != "localhost" && runtimeHost != "127.0.0.1" {
l.Log().Infof("Auto-detected a remote docker daemon, using tools node for loading images")
loadWithToolsNode = true
}
Expand Down

0 comments on commit 18e9eb6

Please sign in to comment.