WSL2 Docker Setup in a Proxmox Guest Windows VM

This article outlines the steps necessary to get Docker running in WSL2 in a virtualized Windows 10 under Proxmox.

·

7 min read

In preparation of test environments for the next localized AI server, I have opted to spin up a Windows 10 guest VM under Proxmox. In the guest VM, the goal is to have a Ubuntu WSL (Windows Subsystem for Linux) running Ollama and Docker. The Docker will also in turn run Open WebUI as a container. Due to the need to ingest various AI models, WSL must reside on a non-system volume that has a lot of cushion for storage space.

The first hurdle, albeit a minor one, was to setup WSL in a custom folder with the latest (at the time of this writing) Ubuntu 24.04 LTS. Default installation guides are available for older Ubuntu versions. But I’ll reiterate the instructions down below with updated link for Ubuntu 24.04 LTS.

I hit another roadblock when I attempted to run Docker on the WSL. I was unable to start the service after doing the standard apt install. Turns out, running Docker under WSL counts on two thing:

  1. “Virtual Machine Platform” enabled under Windows features

  2. WSL running as version 2, instead of the default version 1 when the requirement above is not satisfied.

Both of these are a little tricky to do when the system is already virtualized under Proxmox. The VM must have the right CPU settings under Proxmox, before enabling the Windows feature and manually updating to WSL2. The reason for this is due to WSL limitations. WSL was initially developed as a way to quickly give Windows users most of the functions and experience you would find in Linux. It uses a translation layer that converts the Linux commands that users type in into Windows commands in the backstage, meaning that it is still Windows at its core. The translation layer is not equip to handle virtualization calls required by Docker. WSL2 stepped up the game by introducing itself as a fully virtualized machine with a complete Linux kernel. However, in order for it to run, the VM Windows system must have direct access to CPU subroutines on the Proxmox host, which then in turn will allow “Virtual Machine Platform” feature enabled.

Note: There are ways to make Docker work under WSL. The workaround involves installing the Windows version of Docker, then in WSL configure Docker Compose to point to the Windows install. This is not a valid solution for me, as I need the test environment to reflect a Linux production environment.

The steps below will illustrate how I got it to work.

  1. [This step may be skipped if you are NOT using Windows as a VM]

    Shutdown the Windows VM. Go to Proxmox, and under the Hardware setting, change the CPU type to host. This is going to give the VM direct access to all CPU subroutines.

  2. Power on the Windows VM. Search for “windows features” and click “Turn Windows features on or off”

  3. Scroll down to “Virtual Machine Platform”, and make sure it is ticked. Click the OK button to finalize your setting. A pop-up is going to ask you reboot. Go ahead and click “Reboot Now”.

  4. Once the VM is back up, it’s time to install and configure WSL. The first thing to do is to enable WSL. To do so, Open PowerShell as Administrator (Start menu > PowerShell > right-click > Run as Administrator) and enter this command:

     dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    

    It will take a few moments for this command to complete. After it is done, give it another reboot.

  5. Download and install the WSL2 Linux Kernel package.

    https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

  6. Update WSL in a command prompt.

     wsl --update
    

    Confirm “Yes” in pop-up windows to commit update.

    WSL will begin to update.

  7. Open a command prompt and set WSL2 as the default version with the following command.

     wsl --set-default-version 2
    

  8. Now that we have WSL2 equipped on our Windows VM, the next is to download the actual Linux distribution. The latest Ubuntu LTS at the time of this writing is 24.04. The download link is as follows. Download the file, but do NOT run it as is.

    https://wslstorestorage.blob.core.windows.net/wslblob/Ubuntu2404-240425.AppxBundle

  9. The file downloaded has an extension type “AppxBundle”, which is a common file type associated with Microsoft App Store. But essentially it is just a zip file. So we will rename it to '“.zip” instead of “.AppxBundle”. You might need to disable “Hide extensions for known file types” under View > Options.

  10. After the file extension has been changed to “.zip”, extract all to any folder. The extracted folder will contain several files with the extension type “.appx”. Again, these are essentially just zip files. Rename the “Ubuntu_2404.0.5.0_x64.appx” file into “Ubuntu_2404.0.5.0_x64..zip”, and extract to a folder of your choice.

    In my case, I have extracted the files into “D:\WSL\Ubuntu_2404”

    Note: The way WSL/WSL2 works is that it can have multiple distributions on the system. For this demonstration, there is only one distribution. But if there were more, they could simply be placed in different folders and be registered to WSL, or unregister to remove.

  11. Double click to run the file “ubuntu2404.exe”. There might be prompt from Microsoft Defender warning you that this is an unrecognized app. Click on “More Info” and “Run anyway”

  12. Ubuntu24.04 WSL will begin to install. After a few moments, it will prompt for new user creation. Go ahead and enter the desired username and password.

    Once done, the install is complete. The installer will end up as the terminal window for the WSL.

  13. To verify if everything went correctly, open up a command prompt in the Windows VM. Enter the following command to check for the status of the WSL that was just installed.

    wsl -l -v
    

    The output verifies that Ubuntu-24.04 is indeed running as WSL version 2.

  14. The folder will now contain an extra file named “ext4.vhdx” This is the virtual disk file containing the Linux distribution that has just been installed.

  15. A little clean up can be done by removing all the other files, except for the “ext4.vhdx” file. Once installed, the WSL2 Ubuntu only needs the “ext4.vhdx” file to work.

  16. Up to this point, Ubuntu 24.04 LTS has been installed and running as WSL version 2. You can bring it up by searching for wsl, or simply by entering the command “wsl” inside a command prompt

  17. Docker can now be installed inside the Ubuntu WSL. A detailed guide can be found on Docker’s documentation site.

    https://docs.docker.com/engine/install/ubuntu/

    Or, to save a few clicks, simply enter the following commands into your Ubuntu terminal. I want to warn against copying and pasting the entire code block found in Docker’s documentation all at once. I find that it can mess up the installation. Here a breakdown of the commands to enter in order to avoid that situation.

    Enter the following line by line (note: sudo curl on line 4 is one line all the way until docker.asc):

    sudo apt-get update
    sudo apt-get install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    

    Enter this whole block:

    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
      $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    

    Enter this line:

    sudo apt-get update
    

    Here’s the output.

  18. To install the latest version of Docker, run the following command in WSL terminal.

    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
  19. To test Docker, run the quick test container hello-world

    sudo docker run hello-world
    
  20. Since this is the first time this container is being run, Docker will automatically pulling it from their online library. It takes a brief moment to download, after which the following output should be displayed.

Success! This indicates that Docker is now running under the Ubuntu WSL, in a virtual Windows 10 system, hosted by Proxmox.