Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting socket path on Windows does not work #19918

Open
hansmbakker opened this issue Sep 11, 2023 · 15 comments
Open

Getting socket path on Windows does not work #19918

hansmbakker opened this issue Sep 11, 2023 · 15 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. machine windows issue/bug on Windows

Comments

@hansmbakker
Copy link

Issue Description

This documentation page says to run podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}' to get the socket path.

However, that results in:

Error: template: inspect:1:29: executing "inspect" at <.ConnectionInfo.PodmanSocket.Path>: nil pointer evaluating *machine.VMFile.Path

Just running podman machine inspect shows (I trimmed the output to the relevant ConnectionInfo section:

"ConnectionInfo": {
    "PodmanSocket": null,
    "PodmanPipe": {
         "Path": "\\\\.\\pipe\\podman-machine-default"
     }
}

Steps to reproduce the issue

Steps to reproduce the issue

  1. Open Powershell on Windows 11
  2. Install podman using winget - winget install RedHat.Podman
  3. Install podman desktop using winget - winget install RedHat.Podman-Desktop
  4. Initialize & start podman using podman desktop
  5. Optionally run podman run quay.io/podman/hello to verify podman works
  6. Run podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}'

Describe the results you received

Error: template: inspect:1:29: executing "inspect" at <.ConnectionInfo.PodmanSocket.Path>: nil pointer evaluating *machine.VMFile.Path

Describe the results you expected

A socket path

podman info output

If you are unable to run podman info for any reason, please provide the podman version, operating system and its version and the architecture you are running.

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

Windows desktop (Windows 11 build 22621.2215)

Additional information

No response

@hansmbakker hansmbakker added the kind/bug Categorizes issue or PR as related to a bug. label Sep 11, 2023
@Luap99 Luap99 added machine windows issue/bug on Windows labels Sep 11, 2023
@arixmkii
Copy link
Contributor

arixmkii commented Sep 11, 2023

You can use podman machine inspect --format '{{.ConnectionInfo.PodmanPipe.Path}}'

ConnectionInfo.PodmanSocket.Path is reserved for QEMU and other providers and uses UNIX sockets on supported OS (including Windows), but for using named pipe there is a separate property, because it is different transport protocol.

Background, this decision was introduced, because while Podman machine could optionally support both types, but the Podman Desktop on Windows can operate only with named pipe due to libuv limitations. So, for machine providers, which support real socket they would also need to support named pipe for Podman Desktop compatibility.

@arixmkii
Copy link
Contributor

The documentation in Podman Desktop is wrong. Code part responsible for retrieving path of the pipe https://github.com/containers/podman-desktop/blob/4eca4d670efbdcbaea9443f25833eff08a572bb5/extensions/podman/src/extension.ts#L161

@hansmbakker
Copy link
Author

The documentation in Podman Desktop is wrong. Code part responsible for retrieving path of the pipe https://github.com/containers/podman-desktop/blob/4eca4d670efbdcbaea9443f25833eff08a572bb5/extensions/podman/src/extension.ts#L161

Ok, then I get the pipe but not the socket - will that allow me to set the DOCKER_HOST env var in such a way that it allows for transparent migration from Docker? (and use the VS Code Docker extension, which relies on that env var)

@arixmkii
Copy link
Contributor

@hansmbakker It should work as Docker API on Windows was exposed via named pipe last time I checked it.

@hansmbakker
Copy link
Author

Will try that, thank you!

@hansmbakker
Copy link
Author

Ok - I tried setting the DOCKER_HOST env var to \\.\pipe\podman-machine-default and I set the path to the docker executable to podman but the extension keeps saying it failed to connect. Does anybody have a suggestion?

Besides this extension, podman works fine for the DevContainers extension using podman as a value for the path to the docker executable. The DevContainers extension does not rely on the DOCKER_HOST environment variable.

image

@foxydevloper
Copy link

foxydevloper commented Sep 29, 2023

Here's a fix for the documentation: podman-desktop/podman-desktop#4157
image
You need to prefix the pipe with npipe:// when putting it in the DOCKER_HOST environment variable. Also note, you don't actually need to change the DOCKER_HOST at all if you're on windows. Podman also listens on the docker_engine named pipe that most tools should default to using.

API forwarding listening on: npipe:////./pipe/docker_engine
Docker API clients default to this address. You do not need to set DOCKER_HOST.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@hansmbakker
Copy link
Author

Thank you for the suggested fixes! I tried setting DOCKER_HOST to npipe:////./pipe/docker_engine but unfortunately it did not help. The UI says

Failed to connect. Is Docker running?
Error: Invalid image JSON

TheDocker output window stays empty (no logging or stack traces), and other output windows do not mention anything either.

My environment:

  • Windows 11
  • Podman 4.7.2
  • VS Code 1.84.0
image

@marmotae
Copy link

marmotae commented Dec 6, 2023

Is this still unresolved? im pretty much in the same situation, Cant connect to the npipe from vs code on windows

@Zak-Ghani
Copy link

Seeing same issue on my environment
OS: Win10
VS Code: 1.84.2
Podman: 4.8.1

Have tried all the fixes set out above but still seeing the "Failed to connect. Is Docker installed?" message.
As with everyone else here mentioning the issue I too am in the process of moving from Docker to Podman

@dbiegunski
Copy link

Same issue over here ... trying to replace docker with podman but cannot connect VS Code to Podman..

@Stan-RED
Copy link

The same problem. with VS Code.

@arixmkii
Copy link
Contributor

@StanEgo @dbiegunski @Zak-Ghani @hansmbakker This extension is known to have issues with Podman. Could you test with the extension version downgraded to 1.22.x as workaround? I checked in a test clean system and it worked with 1.22.2

Here is related ticket #17306 And there are numerous tickets in bug tracker of the extension. I'm not a representative of either MS or Podman development team, so, I can't say who should be responsible to fix this.

@ShyamBhattacharyya
Copy link

Currently there is two options available to use podman containers within VS Code.

  1. Use Docker extention version 1.22.2 or below. From version 1.23.0+, the extention has switched from HTTP API based communication with the deamon to CLI based which is creating an compatibility issue between the podman & docker with the command returned keys. For example Id vs ID
    image

  2. Use Pod Manager. A new extention has created by @dreamcatcher45. It is working fine with podman containers. [https://marketplace.visualstudio.com/items?itemName=dreamcatcher45.podmanager&ssr=false#overview](url)
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. machine windows issue/bug on Windows
Projects
None yet
Development

No branches or pull requests

9 participants