STARDUSTLC666/dsh-docker
DeepSeek Harness 容器管理插件:docker_ps/logs/inspect/exec/manage 五工具,官方 subprocess 服务、argv 无 shell 注入、exec 审批门、零运行时依赖。· 面向 DeepSeek Harness 智能体的容器管理方案。
Project Overview项目介绍
DSH plugin for managing Docker containers and images through six tools: list containers/images, view logs, inspect details, run commands inside containers, and control lifecycle. It calls the docker CLI via the official subprocess service, passing arguments as an argv array to eliminate shell injection. The docker_exec tool requires approval by default. Use it when an agent needs to operate Docker hosts in devops workflows. Requires a working docker binary; headless setups will block exec without an approval channel.
DSH 容器管理插件,通过官方 subprocess 服务调用 docker CLI,提供六个工具:容器/镜像列表、日志、详情、容器内执行与生命周期管理。参数以独立 argv 数组传入,无 shell 注入风险,docker_exec 默认开启审批门。适用于让 agent 在 devops 场景中直接管控本地或远端 Docker 主机。需本机已安装并可执行 docker,注意审批门在 headless 环境下会拒绝执行。
请帮我了解并安装插件:【dsh-docker】【https://github.com/STARDUSTLC666/dsh-docker】
Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add @stardustlc/dsh-docker
把 STARDUSTLC666/dsh-docker 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-docker
你的 agent 会管容器了:七个工具覆盖容器/镜像列表、日志、详情、容器内执行、生命周期管理与健康检查。
DSH(DeepSeek Harness)容器管理插件:走官方 subprocess 服务跑 docker CLI,argv 数组无 shell 注入,docker_exec 与破坏性生命周期操作默认审批门,零运行时依赖。
兼容性
已在官方 @deepseek-ai/dsh@0.1.5-rc.1、Node 24.16.0 上验证(2026-09-11):18 个组件与 Modlens 同载,工具 schema、技能注册及离线只读调用检查通过。采用 cordis.patch.yml + dsh.bundle.patch 组合包模型。Node 要求与该版本 Harness 一致:22.19 及以上的 22.x,或 24 及以上。外部服务的实际业务操作需按各组件配置单独验证。
2026-09-13 修复:保留宿主 subprocess.spawn 的服务对象,避免方法独立传递后因 this 丢失而报错。已在官方 0.1.5-rc.1 和 0.1.5-rc.2、Node 24.16.0 上验证。docker_ps 已通过真实宿主进程服务验证;Docker 输出由 Node 子进程生成的固定测试数据提供,未连接真实 Docker daemon。
安装
dsh plugin --profile web add @stardustlc/dsh-docker
需要本机装有 Docker(docker version 能出结果即可);不在 PATH 上时用 dockerPath 指定。
卸载
dsh plugin --profile web remove @stardustlc/dsh-docker
卸载后重启 Web 服务。如需彻底清理,可再手动删除自己 profile cordis.patch.yml 中覆盖的插件行。
配置
- id: docker
name: '@stardustlc/dsh-docker'
config:
# dockerPath: C:\Program Files\Docker\Docker\resources\bin\docker.exe
dockerPath: docker # 可选;也可用环境变量 DSH_DOCKER_PATH
timeoutMs: 60000 # 单次操作超时(默认 60 秒,5 秒 - 10 分钟)
# execApproval: false # 关闭 docker_exec 审批门(默认 true)
# manageApproval: false # 关闭 stop/restart/rm 审批门(默认 true,不推荐)
工具一览
| 工具 | 作用 | 安全 |
|---|---|---|
docker_ps |
列出容器(状态/镜像/运行态,可过滤) | — |
docker_images |
列出本地镜像(仓库/标签/大小/创建时间,可只看悬空镜像) | — |
docker_logs |
查看日志尾部(行数钳制,可短时 follow) | — |
docker_inspect |
容器详情(镜像/状态/端口) | — |
docker_exec |
容器内执行命令 | 审批门 + 容器名白名单校验 |
docker_manage |
start / stop / restart / rm | stop/restart/rm 审批门 |
docker_health |
Docker daemon 与安全配置自检 | — |
示例
docker_ps {}
docker_ps { all: true, name: web }
docker_images { dangling: true }
docker_logs { container: web, tail: 200 }
docker_inspect { container: web }
docker_exec { container: web, command: 'df -h' }
docker_manage { container: web, action: restart }
安全设计
- 无 shell:全部参数独立 argv 数组,命令注入不可能
- 审批门:docker_exec 与 docker_manage 的 stop/restart/rm 默认弹审批;headless 无审批通道时拒绝
- 容器名校验:只允许
[A-Za-z0-9][A-Za-z0-9_.:-]*,杜绝参数注入 - 超时钳制:单次操作 5 秒 - 10 分钟;follow 模式额外限 30 秒
- 日志钳制:tail 1-2000 行
开发
pnpm install
pnpm test # 构建 + 35 个测试
License
MIT
Zhenyu98/dsh-context-doctor
shuguang1994/project-blueprint
omdsh-dev/dsh-advisor