use port forwarding on Linux with Docker Desktop

pull/15126/head
Steven Powell 2022-10-12 15:05:00 -07:00
parent 438f6e5417
commit 2f3fe5d258
2 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,7 @@ type SysInfo struct {
Rootless bool // Weather or not the docker is running on rootless mode
StorageDriver string // the storage driver for the daemon (for example overlay2)
Errors []string // any server issues
DockerOS string // used to detect if using Docker Desktop or Docker Engine on Linux
}
var (
@ -70,7 +71,7 @@ func DaemonInfo(ociBin string) (SysInfo, error) {
break
}
}
cachedSysInfo = &SysInfo{CPUs: d.NCPU, TotalMemory: d.MemTotal, OSType: d.OSType, Swarm: d.Swarm.LocalNodeState == "active", Rootless: rootless, StorageDriver: d.Driver, Errors: d.ServerErrors}
cachedSysInfo = &SysInfo{CPUs: d.NCPU, TotalMemory: d.MemTotal, OSType: d.OSType, Swarm: d.Swarm.LocalNodeState == "active", Rootless: rootless, StorageDriver: d.Driver, Errors: d.ServerErrors, DockerOS: d.OperatingSystem}
return *cachedSysInfo, err
}

View File

@ -212,6 +212,9 @@ func NeedsPortForward(name string) bool {
if err != nil {
panic(err)
}
if runtime.GOOS == "linux" && si.DockerOS == "Docker Desktop" {
return true
}
return si.Rootless
}