DEV Community

abbazs
abbazs

Posted on • Edited on

How to use PODMAN in place of docker in windows?

First enable windows subsystem for linux (WSL)

  1. Enable Windows Subsystem for Linux
    • dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  2. Enable Virtual Machine
    • dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  3. Install podman desktop from podman.io
  4. Install visual studio code (vscode) from https://code.visualstudio.com/
  5. Add extension dev containers to vscode Dev Containers - Visual Studio Marketplace
  6. Update the vscode extension dev containers settings to point to podman instead of docker

    1. Press F1
    2. Enter Dev Containers: Settings in the prompt
    3. And set the value of dev.containers.dockerPath to podman

    docker path

  7. Close vscode and open it again

  8. To verify if all the settings are done correctly:

    1. Open a powershell terminal and execute podman pull python:3.11.4
    2. Execute podman run -it python:3.11.4 python
    3. Do not close the terminal and let it run

Connect to the running container from vscode

  1. Open vscode and look for the >< in the bottom left hand side corner and click on it

    vscode remote

  2. It shall open a dialog on the top of the window and select Attach to Running Container…

    prompt to connect

  3. Wait for vscode to show the running containers

    running containers

  4. Select the container required and you are all set to work inside the container.

  5. vscode will open a new window and connect to the container selected.

  6. Once the new vscode window opened select a folder inside the continaer

    Image description

  7. You are now connected to the container from vscode!

Top comments (2)

Collapse
 
specimen4701 profile image
Paula Pereyra • Edited

Thank you very much, very well explained, it helped me today 08/25/2024. I write the date because it was very difficult for me to find a tutorial that would work for the new versions of podman (version 5.2.2)
In my case it did work because the folder I wanted to access did contain code.

Collapse
 
soerennielsen profile image
soerennielsen

Any idea how to get it to work with Visual Studio? The one that is not code ;)
Building in VS fails to add the container to the podman local images.