mirror of
https://github.com/containers/podman.git
synced 2025-09-11 09:05:23 +08:00
fix: check wsl npipe when executing podman compose
Signed-off-by: lstocchi <lstocchi@redhat.com>
This commit is contained in:
@ -40,6 +40,10 @@ If you want to change the default behavior or have a custom installation path fo
|
|||||||
Annotations: map[string]string{registry.ParentNSRequired: ""}, // don't join user NS for SSH to work correctly
|
Annotations: map[string]string{registry.ParentNSRequired: ""}, // don't join user NS for SSH to work correctly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
pipePrefix = "npipe:////./pipe/"
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// NOTE: we need to fully disable flag parsing and manually parse the
|
// NOTE: we need to fully disable flag parsing and manually parse the
|
||||||
// flags in composeMain. cobra's FParseErrWhitelist will strip off
|
// flags in composeMain. cobra's FParseErrWhitelist will strip off
|
||||||
@ -184,12 +188,18 @@ func composeDockerHost() (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("inspecting machine: %w", err)
|
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 {
|
if info.State != machine.Running {
|
||||||
return "", fmt.Errorf("machine %s is not running but in state %s", item.Name, info.State)
|
return "", fmt.Errorf("machine %s is not running but in state %s", item.Name, info.State)
|
||||||
}
|
}
|
||||||
|
if item.VMType == "wsl" {
|
||||||
|
if info.ConnectionInfo.PodmanPipe == nil {
|
||||||
|
return "", errors.New("pipe of machine is not set")
|
||||||
|
}
|
||||||
|
return strings.Replace(info.ConnectionInfo.PodmanPipe.Path, `\\.\pipe\`, pipePrefix, 1), nil
|
||||||
|
}
|
||||||
|
if info.ConnectionInfo.PodmanSocket == nil {
|
||||||
|
return "", errors.New("socket of machine is not set")
|
||||||
|
}
|
||||||
return "unix://" + info.ConnectionInfo.PodmanSocket.Path, nil
|
return "unix://" + info.ConnectionInfo.PodmanSocket.Path, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user