DEV Community

Ajeet Singh Raina
Ajeet Singh Raina

Posted on

Running Docker Sandboxes on Windows Platform

Prerequisite

  • Enable WSL2 or Hyper V

In this guide, we tested it with Hyper V enablement.

Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -All
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -All
Enter fullscreen mode Exit fullscreen mode

Note: sbx's microVM backend rests on the Windows hypervisor + VirtualMachinePlatform regardless of whether you went the WSL2 or Hyper-V route. All three features you enabled with Enable-WindowsOptionalFeature modify boot-time kernel components, so none of them are fully live until a restart — the API returns success, but the capability isn't actually present in the running kernel yet.
Hence, reboot the system once before proceeding to the next step.

Step 1. Download the latest version of sbx

winget install -h Docker.sbx
Enter fullscreen mode Exit fullscreen mode

If you want to use nightly build, download the release directly from this link: https://github.com/docker/sbx-releases/releases/tag/nightly

Download the .msi file below and double-click to install or
use the command line:

msiexec /i DockerSandboxes.msi /quiet
Enter fullscreen mode Exit fullscreen mode

Step 2. Verify if you've the latest version of sbx

sbx version
sbx version: v0.34.0-rc1-216-g0be67a90 0be67a900e2a642c494353de466135d18d53f338
Enter fullscreen mode Exit fullscreen mode

Step 3. Login to sbx

sbx login
Enter fullscreen mode Exit fullscreen mode

The CLI prints a one-time device confirmation code and a URL.

Step 4. Choose your agent and provider

This lab works with any mainstream coding agent. Pick the provider whose API key you have - the rest of the lab will adapt.

Pick a provider for the rest of this lab. Each option below assumes you've chosen one of these:

- Use OpenAI + Codex
- Use Anthropic + Claude
- Use Google + Gemini
Enter fullscreen mode Exit fullscreen mode

OpenAI configuration:

You'll run Codex inside the sandbox, authenticated to OpenAI.

First, export your API key in your host terminal** (don't paste it into this page):

If you're using Windows:

$env:OPENAI_API_KEY = "sk-proj-..."
Enter fullscreen mode Exit fullscreen mode

Then store it as a global sbx secret. The command below reads $OPENAI_API_KEY from your shell - your key never leaves the terminal and is not displayed anywhere:

Anthropic configuration:

You'll run Claude Code inside the sandbox, authenticated to Anthropic.

First, export your API key in your host terminal (don't paste it into this page):

$env:ANTHROPIC_API_KEY = "sk-ant-..."
Enter fullscreen mode Exit fullscreen mode
Then store it as a global sbx secret. The command below reads `$ANTHROPIC_API_KEY` from your shell - your key never leaves the terminal and is not displayed anywhere:
Enter fullscreen mode Exit fullscreen mode

Gemini configuration

You'll run Gemini CLI inside the sandbox, authenticated to Google.

First, export your API key in your host terminal (don't paste it into this page):

$env:GEMINI_API_KEY = "AIza..."
Enter fullscreen mode Exit fullscreen mode

Then store it as a global sbx secret.

The command below is just an example that shows how it reads keys from your shell - your key never leaves the terminal and is not displayed anywhere:

echo "$GOOGLE_API_KEY" | sbx secret set -g google
echo "$ANTHROPIC_API_KEY" | sbx secret set -g claude
echo "$OPENAI_API_KEY" | sbx secret set -g openai
Enter fullscreen mode Exit fullscreen mode

Step 5. Clone the lab repository

The exercises use DevBoard - a full-stack FastAPI + Next.js issue tracker with intentional bugs. It's pre-configured for this lab.

git clone https://github.com/dockersamples/sbx-quickstart ~/sbx-lab
cd ~/sbx-lab
Enter fullscreen mode Exit fullscreen mode

Step 6. Create your sandbox

cd ~/sbx-lab
sbx create --name=sbxlab <agent> .
Enter fullscreen mode Exit fullscreen mode

First run: The agent image will pull (1–2 minutes) and the sandbox will be created with the Balanced network policy you selected at login.

Image3

sbx ls
Enter fullscreen mode Exit fullscreen mode

You should see sbxlab in the list with status stopped:

PS C:\Users\ajeet> sbx ls
SANDBOX AGENT STATUS PORTS WORKSPACE
shell-sbx-kits-box-main shell stopped C:\Users\ajeet\Downloads\sbx-kits-box-main\sbx-kits-box-main
PS C:\Users\ajeet>
Enter fullscreen mode Exit fullscreen mode

Once you run it (Step 6), the status changes to running.

Step 7. Run your sandbox

sbx run shell-sbx-kits-box-main
Enter fullscreen mode Exit fullscreen mode

Select 1. Yes, continue to launch the agent.

Why this prompt exists: sbx mounts only your project directory into the microVM. The trust check ensures you're aware of what the agent can see and act on.

sbx ls
SANDBOX AGENT STATUS PORTS WORKSPACE
shell-sbx-kits-box-main shell running C:\Users\ajeet\Downloads\sbx-kits-box-main\sbx-kits-box-main
PS C:\Users\ajeet>
Enter fullscreen mode Exit fullscreen mode

Set up the Network Policy

PS C:\Users\ajeet> sbx policy reset
Found 1 running sandbox(es):

shell-sbx-kits-box-main
The daemon will be stopped to apply the policy reset.
Running sandboxes will be terminated.

Are you sure you want to continue? (y/N): y
Stopping daemon at \.\pipe\docker_kaname_sandboxd...
✓ Daemon stopped successfully
✓ Policies reset.

Daemon started (PID: 28492, socket: \.\pipe\docker_kaname_sandboxd)
Logs: C:\Users\ajeet\AppData\Local\DockerSandboxes\sandboxes\state\sandboxd\daemon.log
Enter fullscreen mode Exit fullscreen mode

Verify that you're in a Sandbox environment:

agent@shell-sbx-kits-box-main:sbx-kits-box-main$ cat /etc/os-release
PRETTY_NAME="Ubuntu 26.04 LTS"
NAME="Ubuntu"
VERSION_ID="26.04"
VERSION="26.04 (Resolute Raccoon)"
VERSION_CODENAME=resolute
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=resolute
LOGO=ubuntu-logo
agent@shell-sbx-kits-box-main:sbx-kits-box-main$ sbx policy reset
bash: sbx: command not found
agent@shell-sbx-kits-box-main:sbx-kits-box-main$ 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)