跳到正文
Skillpedia
部署与云(DevOps)10k · #12024

docker

它能做什么

这个技能在 Docker 容器中运行研究或实验代码,使其与宿主机分离。适合希望安全、可重复运行的研究人员。

适用场景

  • ✓你想安全地运行来自不熟悉的论文仓库的代码的时候。
  • ✓实验会安装软件包或更改系统设置,应当保持隔离的时候。
  • ✓你需要以可重复的方式设置 GPU 或 Python 环境的时候。

技能链接

https://github.com/Companion-Inc/feynman/blob/main/skills/docker/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/Companion-Inc/feynman/blob/main/skills/docker/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在 Docker 容器中运行这篇论文的训练代码,使其不会改动我电脑上的任何内容。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能把项目文件夹挂载到容器中,在那里运行实验命令,并把结果写回同一文件夹。它会为工作选择合适的基础镜像。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Docker Sandbox

Run research code inside Docker containers while Feynman stays on the host. The container gets the project files, runs the commands, and results sync back.

When to use

  • User selects "Docker Sandbox" as the execution environment in /replicate or /autoresearch
  • Running untrusted code from a paper's repository
  • Experiments that install packages or modify system state
  • Any time the user asks to run research code safely or isolated for a Feynman workflow

How it works

  1. Build or pull an appropriate base image for the research code
  2. Mount the project directory into the container
  3. Run experiment commands inside the container
  4. Results write back to the mounted directory

Running commands in a container

For Python research code (most common):

docker run --rm -v "$(pwd)":/workspace -w /workspace python:3.11 bash -c "
  pip install -r requirements.txt &&
  python train.py
"

For projects with a Dockerfile:

docker build -t feynman-experiment .
docker run --rm -v "$(pwd)/results":/workspace/results feynman-experiment

For GPU workloads:

docker run --rm --gpus all -v "$(pwd)":/workspace -w /workspace pytorch/pytorch:latest bash -c "
  pip install -r requirements.txt &&
  python train.py
"

Choosing the base image

Research type Base image
Python ML/DL pytorch/pytorch:latest or tensorflow/tensorflow:latest-gpu
Python general python:3.11
Node.js node:20
R / statistics rocker/r-ver:4
Julia julia:1.10
Multi-language ubuntu:24.04 with manual installs

Persistent containers

For iterative experiments (like /autoresearch), create a named container instead of --rm. Choose a descriptive name based on the experiment:

docker create --name <name> -v "$(pwd)":/workspace -w /workspace python:3.11 tail -f /dev/null
docker start <name>
docker exec <name> bash -c "pip install -r requirements.txt"
docker exec <name> bash -c "python train.py"

This preserves installed packages across iterations. Clean up with:

docker stop <name> && docker rm <name>

Notes

  • The mounted workspace syncs results back to the host automatically
  • Containers are network-enabled by default — add --network none for full isolation
  • For GPU access, Docker must be configured with the NVIDIA Container Toolkit
常见问题

我需要安装 Docker 吗?

需要。命令使用 Docker,因此必须在你的电脑上安装。

它可以使用 GPU 吗?

可以。这个技能包含适用于需要 GPU 的任务的命令。

结果保存在哪里?

结果会写回挂载的项目文件夹,因此你可以在电脑上看到它们。

详情

作者的原始描述

Execute research code inside isolated Docker containers for safe replication, experiments, and benchmarks. Use when the user selects Docker as the execution environment or asks to run code safely, in isolation, or in a sandbox.

repo: Companion-Inc/feynman

热度

GitHub 星标
10k
排名
#12024
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能