Skip to content

Commit

Permalink
Merge pull request #20491 from vrothberg/cherry-pick-20478-to-v4.7
Browse files Browse the repository at this point in the history
[4.7] fix: check wsl npipe when executing podman compose
  • Loading branch information
mheon committed Oct 27, 2023
2 parents 85b5f57 + 0341384 commit afb7d7e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/podman/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,18 @@ func composeDockerHost() (string, error) {
if err != nil {
return "", fmt.Errorf("inspecting machine: %w", err)
}
if info.ConnectionInfo.PodmanSocket == nil {
return "", errors.New("socket of machine is not set")
}
if info.State != machine.Running {
return "", fmt.Errorf("machine %s is not running but in state %s", item.Name, info.State)
}
if machineProvider.VMType() == machine.WSLVirt {
if info.ConnectionInfo.PodmanPipe == nil {
return "", errors.New("pipe of machine is not set")
}
return strings.Replace(info.ConnectionInfo.PodmanPipe.Path, `\\.\pipe\`, "npipe:////./pipe/", 1), nil
}
if info.ConnectionInfo.PodmanSocket == nil {
return "", errors.New("socket of machine is not set")
}
return "unix://" + info.ConnectionInfo.PodmanSocket.Path, nil
}

Expand Down

0 comments on commit afb7d7e

Please sign in to comment.