- Windows 10/11 Pro, Enterprise, or Education (with Hyper-V support)
- Windows Server 2019 or later
- Docker Desktop for Windows configured to use Windows containers (not Linux containers)
Docker uses the host OS kernel. Windows containers require the Windows kernel, which is only available on Windows hosts. This is different from Linux containers, which can run on Mac/Linux using virtualization.
If you have access to a Windows machine, follow these steps:
In Docker Desktop:
- Right-click the Docker icon in system tray
- Select "Switch to Windows containers..."
docker build -f Dockerfile.windows -t npm-practice-windows .Note: First build may take 10-30 minutes as it downloads Windows Server Core base image (~4-5GB)
test-windows-auto.cmdOr manually:
docker run --rm npm-practice-windows powershell -Command "cd C:\npm-practice-source; node test-cli.js"docker run -it --rm npm-practice-windowsThen inside the container:
cd C:\npm-practice-source
node index.jsBased on Mac and Linux testing, we expect:
- ~80-90 tasks to pass
- ~18-22 tasks to skip (authentication required)
- ~0-5 tasks to potentially fail (platform-specific issues)
- No sudo needed - Windows doesn't use sudo, but may require admin privileges for global installs
- Path separators - Windows uses backslashes (
\) instead of forward slashes (/) - Shell commands - Some Unix commands may not work (e.g.,
rm,ls,grep) - windowsCheckCommand - tasks.json includes Windows-specific validation commands
For automated Windows testing, you can use:
- GitHub Actions:
windows-latestrunner with Docker Desktop - Azure Pipelines: Native Windows containers support
- AppVeyor: Windows CI/CD platform
Example GitHub Actions workflow:
name: Test on Windows
on: [push, pull_request]
jobs:
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Switch to Windows containers
run: |
& "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine
- name: Build and test
run: |
docker build -f Dockerfile.windows -t npm-practice-windows .
docker run --rm npm-practice-windows powershell -Command "cd C:\npm-practice-source; node test-cli.js"If Docker Windows containers aren't available, you can test directly on Windows:
- Install Node.js from https://nodejs.org
- Clone the repository
- Run
node test-cli.jsdirectly
This tests the npm commands natively without containerization.
Solution: You're trying to run Windows containers on Mac/Linux. See "Requirements" section above.
Solution: First Windows container build downloads large base image. Subsequent builds are much faster.
Solution: Run in elevated PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser