WSL & Docker
Running Ubuntu with WSL ..
WSL & Docker
Using WSL and Docker for LLMs
Windows Subsystem for Linux (WSL) paired with Docker creates a powerful environment for working with Large Language Models. WSL provides a Linux-compatible kernel interface on Windows, allowing developers to run Linux tools directly alongside their Windows applications. When combined with Docker's containerization capabilities, this setup enables consistent deployment of LLM environments across different machines while isolating dependencies.
Docker containers package everything needed to run an LLM—from specific Python versions to specialized CUDA drivers for GPU acceleration—making it straightforward to deploy models like Llama, Mistral, or other open-source LLMs locally. This approach simplifies environment management, reduces "works on my machine" problems, and makes scaling from development to production more seamless, all while preserving Windows as your primary operating system.
WSL
Windows Subsystem for Linux (WSL) enables developers to run a GNU/Linux environment on Windows. The Ubuntu distribution for WSL is tightly integrated with the Windows OS, supporting features including remote development with popular IDEs and cross-OS file management.
Ubuntu on WSL provides a productive terminal environment that can also be used to launch Linux-native graphical applications.
There are multiple ways of installing distros on WSL:
Microsoft Store application
WSL commands run in the terminal
PowerShell
List available versions.
wsl --list --online

Install a version using a NAME from the output
wsl --install -d Ubuntu-24.04
You’ll see an indicator of the installation progress in the terminal.

Once completed you have access to the WSL subsystem.

Launch Unbuntu 24.04 LTS.
wsl.exe -d Ubuntu-24.04
Enter username & password.

Close and open a new Terminal.
Check all your currently installed distros and the version of WSL.
wsl -l -v
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Users\jpore> wsl -l -v
NAME STATE VERSION
* Ubuntu-24.04 Stopped 2
PS C:\Users\jpore>
Run and configure Ubuntu
Select Ubuntu 24.04 from the drop-down terminal.

2. Install the latest updates.
sudo apt update && sudo apt full-upgrade -y

Network
WSL doesn't connect to the internet from within the distro. The reason is because Windows automatically generates resolv.conf file with the wrong nameserver.
You may also need to stop WSL from resetting this file when opening future terminals
Check if you already have internet connectivity.
ping google.com
Check /etc/resolv.conf.
cat /etc/resolv.conf
Create a proper resolv.conf.
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "nameserver 8.8.4.4" >> /etc/resolv.conf'
Generate a new /etc/wsl.conf file. This will prevent the resolv.conf being recreated on each session.
sudo bash -c 'cat > /etc/wsl.conf << EOF
[network]
generateResolvConf = false
EOF'
Restart WSL.
wsl --shutdown
Last updated