← 全部工具

ylwl1997/docker2wslc

AI Agent
热度 75 更新于 AI 与 Agent

Convert Docker commands and Compose files to wslc, the native WSL container runtime on Windows 11. CLI (PyPI + npm), MCP server, VS Code diagnostics.

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

docker2wslc

Tooling for wslc — the native Linux container runtime built into the Windows Subsystem for Linux, which runs OCI containers on Windows 11 without Docker Desktop.

One rule table, four consumers. No network calls, no daemon, no telemetry.

| Package | Registry | What it does | |---------|----------|--------------| | docker2wslc | PyPI | CLI + Python API: convert, compose, lint | | docker2wslc | npm | Same CLI for Node, same output | | wslc-mcp | npm | MCP server for Claude Code, Cursor, Windsurf | | wslc-compatibility | not published — install from .vsix | Inline diagnostics for Compose / devcontainer files |

Quick start

# Python
pip install 'docker2wslc[yaml]'
docker2wslc convert docker run --gpus all -p 80:80 nginx

# Node
npx docker2wslc lint .

# AI agents
claude mcp add wslc -- npx -y wslc-mcp
$ docker2wslc convert docker run --gpus all --restart always -p 8080:80 nginx
wslc run --gpus all -p 8080:80 nginx

Migration notes
  WARN  Restart policies are not implemented in the wslc preview. Flag dropped — use a
        Windows scheduled task or a wrapper script for auto-restart.
  INFO  `--gpus` is native in wslc 2.9.4, but the host must actually have the GPU: on a
        machine without one, `--gpus all` fails at container init with an ldconfig error.

Exit codes

Meaningful, so lint works as a CI gate:

| Code | Meaning | |------|---------| | 0 | Fully compatible | | 1 | Degraded — flags dropped or rewritten, still runnable | | 2 | Unmigratable — Compose, Swarm, buildx, or a parse failure |

The rule worth knowing

CLI-driven tooling ports to wslc. API-driven tooling does not.

wslc is daemonless: no dockerd, no socket, no Engine API. Anything that opens a Docker socket cannot attach; anything that shells out to a binary works once pointed at wslc.

That explains why VS Code Dev Containers works (set dev.containers.dockerPath to wslc) while Testcontainers cannot, no matter how you set DOCKERHOST.

Architecture

rules.json is the single source of truth — verb mappings, flag behaviour, Compose and devcontainer key support, tool compatibility. Every package reads it, so the Python CLI, the npm CLI, the MCP server and the VS Code extension cannot drift apart.

A parity test asserts the Python and JavaScript engines produce byte-identical output (command, exit code and notes) across the full case matrix.

rules.json ──┬── packages/py      (PyPI)
             ├── packages/cli     (npm)
             ├── packages/mcp     (npm, MCP)
             └── packages/vscode  (.vsix, unpublished)