Everything required to use Podman error-free with Dev Containers on WSL2 #25607
Replies: 3 comments 1 reply
-
This deserves to be pinned on a wall somewhere |
Beta Was this translation helpful? Give feedback.
-
I'm trying something a tad more complicated. Might not work, but worth a shot. I want to work and clone my repositories in my usual wsl distibution (ubuntu 24.04), but I want podman to use the podman machine. Podman does have a documentation on this: https://podman-desktop.io/docs/podman/accessing-podman-from-another-wsl-instance I cloned my repo on my wsl distribution, opened it in vscode, changed the default command from docker to podman, and tried to build the container. But I'm met with this message. Might be too much of a stretch, but I'm still looking for a solution. |
Beta Was this translation helpful? Give feedback.
-
This is a great quick start guide! It seems that Step 3 doesn't persist across WSL restarts however? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This guide is intended to spark a discussion about the many papercuts Windows developers will face when configuring Podman with Dev Containers on WSL2. All steps detailed here were necessary for achieving a successful, error-free, setup.
Is there any appetite from Podman devs to do a virtual "empathy session" where we all sit down and attempt to run the example Dev Container on WSL2, starting from zero? I think it could be fun! 😄 🪿 🌎
cc @n1hility @rhatdan who I've had fruitful discussions with in the past when I first created #15338.
Step 1: Initialize a Podman machine
Step 2: Resolve broken
podman stats
Follow these steps:
Open your WSL2 configuration file at
%UserProfile%\.wslconfig
.Add or update the following configuration:
Save the file.
This configuration disables cgroups v1, enabling cgroups v2, and resolves microsoft/WSL#10050.
Step 3: Resolve shared mount warning
If you receive this warning:
Run these commands:
This resolves microsoft/vscode-remote-release#9303.
Step 4: Resolve rootless Podman issues
To work around issues with rootless Podman (such as permissions issues creating and manipulating directories and files), set the following in
devcontainer.json
:Step 5: Allow locally built images to be pulled
For error,
Pinging container registry localhost connection refused
, create a custom Podman configuration file:This resolves #19856
Step 6: Enable VS Code to connect to Podman socket
For error,
RemoteSocket: path: /mnt/wslg/runtime-dir/podman/podman.sock is not available.
modify or create /etc/wsl.conf within your Podman Machine to add:This resolves #16861
For context, see #15190 (comment):
Step 7: Restart WSL2
Example configuration files
Utilize these configuration examples for your Dev Container setup:
docker-compose.yml
Dockerfile
devcontainer.json
Beta Was this translation helpful? Give feedback.
All reactions