Install Docker SBX on WSL
Overview
This KB explains how to install the Docker Sandboxes (sbx) CLI inside Windows Subsystem for Linux (WSL) on an Ubuntu/Debian-based distribution.
Prerequisites
- Windows 10/11 with WSL2 enabled
- Ubuntu/Debian-based WSL distro installed.
- Admin access on the Windows host
1. Enable nested virtualization in WSL
-
Open your Windows user profile folder (for example:
C:\Users\<YourUsername>). -
Create or edit a file named
.wslconfigwith the following contents:[wsl2]nestedVirtualization=true -
Open an elevated PowerShell (or standard if allowed) and fully restart WSL:
wsl --shutdown -
Restart your WSL distro (open your Ubuntu terminal again).
Note: enabling nested virtualization allows the WSL kernel to expose KVM capabilities required by sbx.
2. Install the sbx CLI inside WSL
Open your WSL terminal and run these commands sequentially:
-
Register Docker repositories (official setup script only registers
aptsources)curl -fsSL https://get.docker.com | sudo REPO_ONLY=1 sh -
Update and install the sbx CLI package
sudo apt-get update && sudo apt-get install -y docker-sbx -
Add your user to the kvm group so sbx can access the virtualization layer
sudo usermod -aG kvm $USER -
Refresh group membership without logging out (applies
immediately in current shell)newgrp kvm -
If
docker-sbxis not available in your distribution's mirrors after running the setup script, confirm that the Docker repository was added:/etc/apt/sources.list.d/Then re-run:
sudo apt-get update`.
3. Authenticate and run a test sandbox
-
Login to sbx (authenticate with your Docker ID):
sbx login -
Start a sandbox in a project directory (example: Claude agent):
cd ~/your-project-directorysbx run claude
If authentication or credential storage has issues in WSL, this is a known area tracked on Docker's sbx GitHub Issues. Try logging in from the Windows host or consult the issue tracker for workarounds.
Notes
-
If
kvmdevices are unavailable- Check
/dev/kvminside WSL. - If missing, confirm that
nestedVirtualization=trueis present in.wslconfig - Ensure
wsl --shutdownwas executed on Windows.
After
usermod -aG kvm, you can try logging out and back in (or opening a new shell)This ensures group membership persists across sessions.
- Check
-
If
sbx runfails due to missing dependencies- Check
dmesgandjournalctloutput inside WSL for kernel or KVM errors.
- Check