跳到主内容
智客 ZICQ

技能库 智客分类:运维与云 docker-via-wsl

Docker Via Wsl

当您( AI 代理) 在 Windows OutSIDE WSL (Git Bash/ MSYS/ PowerShell shell) 上运行时使用, 并且需要运行任意多克/多克作曲命令 。 Docker桌面运行在WSL2引擎上,因此命令必须通过wsl.exe重新发布INSIDE WSL——从Windows shell运行在网络/SMB驱动器(Z:,UNC)上会腐蚀绑定-挂载路径. 如果您的外壳已经在 WSL 内, 则不适用 。 触发器:多克,多克作曲,多克作曲,容器,绑定挂载,音量,"是目录",挂载源错误,Windows +多克桌面,WSL.

54 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

当您( AI 代理) 在 Windows OutSIDE WSL (Git Bash/ MSYS/ PowerShell shell) 上运行时使用, 并且需要运行任意多克/多克作曲命令 。 Docker桌面运行在WSL2引擎上,因此命令必须通过wsl.exe重新发布INSIDE WSL——从Windows shell运行在网络/SMB驱动器(Z:,UNC)上会腐蚀绑定-挂载路径. 如果您的外壳已经在 WSL 内, 则不适用 。 触发器:多克,多克作曲,多克作曲,容器,绑定挂载,音量,"是目录",挂载源错误,Windows +多克桌面,WSL.

何时用

您( AI 代理) 运行在 Windows OutSIDE WSL (Git Bash/MSYS/PowerShell shell) 上, 需要运行任意多克/多克作曲命令 。 Docker桌面运行在WSL2引擎上,所以命令必须通过 wsl.exe 重新发布 INSIDE WSL - 从 Windows shell 在网络上运行

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Docker via WSL (Windows)、When this applies、The problem、Why it matters、The rule、Diagnosis and fix。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/diagnosis-and-fix.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Use when YOU (the AI agent) are running on Windows OUTSIDE WSL (Git Bash/MSYS/PowerShell shell) and need to run ANY docker / docker compose command. Docker Desktop runs on the WSL2 engine, so commands must be re-issued INSIDE WSL via wsl.exe -- running them from the Windows shell on a network/SMB drive (Z:, UNC) corrupts bind-mount paths. Does NOT apply if your shell is already inside WSL. Triggers on: docker, docker compose, docker-compose, container, bind mount, volume, 'is a directory', mount source wrong, Windows + Docker Desktop, WSL.

Docker via WSL (Windows)When this appliesThe problemWhy it mattersThe ruleDiagnosis and fix

兼容:Windows host with Docker Desktop using the WSL2 backend. · 许可:(MIT AND CC-BY-SA-4.0)

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
docker-via-wsl
description
Use when YOU (the AI agent) are running on Windows OUTSIDE WSL (Git Bash/MSYS/PowerShell shell) and need to run ANY docker / docker compose command. Docker Desktop runs on the WSL2 engine, so commands must be re-issued INSIDE WSL via wsl.exe -- running them from the Windows shell on a network/SMB drive (Z:, UNC) corrupts bind-mount paths. Does NOT apply if your shell is already inside WSL. Triggers on: docker, docker compose, docker-compose, container, bind mount, volume, 'is a directory', mount source wrong, Windows + Docker Desktop, WSL.
compatibility
Windows host with Docker Desktop using the WSL2 backend.
许可
(MIT AND CC-BY-SA-4.0)
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • references/diagnosis-and-fix.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「docker-via-wsl」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-06fd71d3d38ea47b-%E5%A4%9A%E5%85%8B%E7%BB%B4-%E7%BC%A9%E5%86%99.html
请存为 .cursor/skills/docker-via-wsl/SKILL.md 或 .claude/skills/docker-via-wsl/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/netresearch/docker-development-skill 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/netresearch/docker-development-skill' --list

npx skills add 'https://github.com/netresearch/docker-development-skill' --skill 'docker-via-wsl'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: docker-via-wsl description: "Use when YOU (the AI agent) are running on Windows OUTSIDE WSL (Git Bash/MSYS/PowerShell shell) and need to run ANY docker / docker compose command. Docker Desktop runs on the WSL2 engine, so commands must be re-issued INSIDE WSL via wsl.exe -- running them from the Windows shell on a network/SMB drive (Z:, UNC) corrupts bind-mount paths. Does NOT apply if your shell is already inside WSL. Triggers on: docker, docker compose, docker-compose, container, bind mount, volume, 'is a directory', mount source wrong, Windows + Docker Desktop, WSL." license: "(MIT AND CC-BY-SA-4.0)" compatibility: "Windows host with Docker Desktop using the WSL2 backend." metadata: version: "1.16.3" repository: "https://github.com/netresearch/docker-development-skill" author: "Netresearch DTT GmbH" allowed-tools: - "Bash(wsl.exe:*)" - "Bash(docker:*)" - "Bash(uname:*)" - "Read" - "Glob" - "Grep" --- # Docker via WSL (Windows) ## When this applies This applies when **you, the AI agent, are running on a Windows host and your shell is OUTSIDE WSL** -- your Bash tool is Git Bash/MSYS (`uname -s` shows `MINGW64…`/`MSYS…`) or you are in PowerShell/cmd. The `docker` binary there talks to Docker Desktop, but the daemon and its filesystem live in WSL2, so you must run commands inside WSL via `wsl.exe`. If your shell is **already inside WSL** (`uname -s` shows `Linux`, native path `/home//...`), this skill does **not** apply -- run `docker` directly. ## The problem On Windows, Docker Desktop's daemon runs **inside the WSL2 VM**. Issue **every `docker` command** -- `run`, `build`, `exec`, `pull`, `push`, `volume`, `network`, `inspect`, `compose`, … -- **from inside WSL**, against a **native Linux path**. Never from a Windows shell (Git Bash/MSYS/PowerShell), especially on a mapped network/SMB drive (`Z:`, UNC `\\host\share`). ## Why it matters Driving Docker from a Windows shell whose CWD is on a network share forces Docker Desktop to translate the Windows bind path (e.g. `Z:\proj\config`) into a VM path. On SMB/UNC drives this is unreliable: it can **duplicate a path segment** (e.g. `…/user/user/proj/config`), so Docker mounts a **wrong, empty directory** and **auto-creates the missing bind source as an empty directory**. A file the container expects (`init.sql`, a config file) then appears as a **directory** -> `could not read from input file: Is a directory`. Your editor writes still land on the *correct* path via the share, so host and container views silently diverge. This is NOT a Docker cache bug nor a "single-file bind mounts are fragile" problem (single-file binds work fine from WSL). The root cause is **piloting Docker from Windows/SMB instead of from WSL**. ## The rule Run **any** Docker command through WSL, in a native Linux path: ```bash wsl.exe -e bash -lc "cd /home// && docker compose up -d" wsl.exe -e bash -lc "docker ps" wsl.exe -e bash -lc "docker build -t myimg /home//" ``` Keep the project on the **Linux filesystem** the WSL distro sees natively (`/home//...`), not browsed through the Windows drive letter. ## Diagnosis and fix See `references/diagnosis-and-fix.md` for inspecting the mounted path, comparing host vs container views, and cleaning up a phantom bind directory.

相关技能

运维与云

Docker Essentials

用于容器管理,图像操作,调试的基本道克命令和工作流程.

运维与云

Find Skills

从开放的代理技能生态系统中发现并安装技能. 使用时:(1)用户问"我如何做X",X可能拥有现有技能,(2)用户说"为X找到技能"或"是否为X有技能",(3)用户问"你能否做X",X是专门能力,(4)用户想扩展代理能力,(5)用户想搜索工具,模板,或工作流程,(6)用户提到他们希望…

运维与云

Microsoft Foundry

构建,部署,评价,优化,微调,管理微软创始代理,模型,资源最终结束. 用法:铸造、azd ai代理、azd 提供/部署、托管代理脚手架/开发/运行/部署/拖放、即时代理创建、创建代理、更新代理、添加代理工具、援引代理、代理.yaml、评估代理、批量活化、连续活化、持续监测、代理C…

运维与云

Azure Deploy

执行已有.azure/部署计划.md和基础设施文件的ALREADY-PREPARED应用程序的Azure部署。 当用户向 CREATE 请求新应用程序时, 请不要使用此技能 。 这种技能运行了 azd上行, azd 部署, trarraform 应用, 和 az 部署命令带有内置…