Running Docker in WSL with Windows Folder Access

Goal

Run Docker containers in WSL that can access Windows folders directly.

Install WSL

List available distributions and install Ubuntu:

wsl --list --online
wsl --install Ubuntu

Access Windows Folders from WSL

Windows drives are mounted under /mnt/ in WSL. Navigate to any Windows folder:

cd /mnt/c/Users/bustroker/windowsfolder

Run Docker with Windows Folder Mounts

Mount the current Windows directory into a container:

docker run --rm -v $(pwd):/windowsfolder openapitools/openapi-diff /windowsfolder/openapi_v2.json /windowsfolder/openapi_v3.json

The $(pwd) expands to the Windows path (e.g., /mnt/c/Users/bustroker/windowsfolder), making it accessible inside the container at /windowsfolder.