detect wsl and add port forward

pull/8368/head
Medya Gh 2020-06-03 14:39:34 -07:00
parent 87418f8388
commit 02749de984
1 changed files with 6 additions and 1 deletions

View File

@ -131,7 +131,12 @@ func NeedsRoot(name string) bool {
// NeedsPortForward returns true if driver is unable provide direct IP connectivity
func NeedsPortForward(name string) bool {
// Docker for Desktop
return IsKIC(name) && (runtime.GOOS == "darwin" || runtime.GOOS == "windows")
return IsKIC(name) && (runtime.GOOS == "darwin" || runtime.GOOS == "windows" || isMicrosoftWSL())
}
// isMicrosoftWSL will return true if process is running in WSL in windows
func isMicrosoftWSL() bool {
return os.Getenv("WSL_DISTRO_NAME") != ""
}
// HasResourceLimits returns true if driver can set resource limits such as memory size or CPU count.