Skip to content

Commit

Permalink
fix: check wsl npipe when executing podman compose
Browse files Browse the repository at this point in the history
[NO NEW TESTS NEEDED]

Signed-off-by: lstocchi <lstocchi@redhat.com>
Cherry-picked-by: Valentin Rothberg <vrothberg@redhat.com>
  • Loading branch information
lstocchi authored and vrothberg committed Oct 26, 2023
1 parent 85b5f57 commit 0341384
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 0341384

Please sign in to comment.