-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow to automatically set podman connection for other WSL2 instances #15190
Comments
How can this work? There are no ssh keys setup, we have no way of knowing how to start the podman system service (systemd is not available usually). If users need this they can always manually create the connection. |
there are ssh keys set up, and would have to be copied to the WSL distro. graph TD;
WSL-Ubuntu-->WSL-Podman;
This is something Docker also allows to do. @n1hility WDYS? |
I am not sure how docker-desktop sets tis up behind the scenes but I can access docker commands from WSL2 existing distributions. Getting this to work with podman would be amazing since it means we'll have transparent switch from docker to podman without any workflow changes. |
We could theoretically add a podman machine command to provision a client config on a WSL instance. For example, something like (On Windows prompt):
This would also work with alias docker=podman There are two challenges though:
|
Actually it might also be possible to share a mounted VHD and symlink docker.sock there instead of an ssh forward. |
A friendly reminder that this issue had no activity for 30 days. |
Any update on this? |
A friendly reminder that this issue had no activity for 30 days. |
FYI, this, along with #15338 look like barriers to using devcontainers hosted in VS Code executes docker commands within WSL itself when they are contained within the wsl filesystem. This works in Docker Desktop, which makes The other option is to configure VS Code to run the docker commands in the podman distribution. But this does not work due to #15338. We don't typically use devcontainers hosted within the Windows filesystem, for performance and compatibility reasons. An |
@n1hility This might be an option we wanna enable WSL wide or targeted per distribution? The issue is that we also need to 'clean' this after the stop of podman machine. |
Closed dup which contained the following: Currently, if you want to do this, manually creating the bind is the recommended approach. For example, for rootless: touch /mnt/wsl/podman.sock touch /mnt/wsl/podman.sock /mnt/wsl/podman/podman-machine-default-rootless.sock |
According to the instructions from @n1hility, this can be done as follows:
After this, you can use the following to use the remote Podman machine from your 'default' WSL:
|
@gbraad Thanks for these instructions. Is there a way to permanently set |
@frenchesco you can set
|
You can also do podman system connection add (If there is more than one you can set the default with podman system connection default). Then you could edit your system containers conf under the engine section and set remote=true. |
Otherwise an alias could work if you use multiple podman instances at the same time. The parameters for |
How does this solution work with Test Containers? This env vars are coming from: https://java.testcontainers.org/features/configuration/ at the last section. |
Thanks all! I have it mostly working except when I specify volumes in WSL via something like How can I map folders from my WSL home directory to podman remote? |
I also have same error as @frenchesco and related to my question with testcontainers I always get:
And also when trying to run docker-compose:
So looks like all these could be related |
For WSL2 a new instance is created and a connection is added for interaction from the host using the podman-remote client, however people might like to use podman from other WSL installed distros on the same machine. For this, a new connection would need to be added to those instances. Enabling this in an easy way using a command?
Connections are composed as follows:
the port, eg
59971
in this example is randomly generated.ref: #15107
The text was updated successfully, but these errors were encountered: