docker-extend
它能做什么
这项技能使用 Dockerfile.user 和 docker-compose.override.yml 两个文件,为项目的 Docker 容器做个人定制,这两个文件不纳入 git。适合希望在容器中使用额外工具的开发者。
适用场景
- ✓当你想在项目的 Docker 容器中安装额外工具供自己使用时。
- ✓当你想个性化自己的 Docker 设置,又不影响同事时。
- ✓当你不确定 Docker 设置是从源代码构建,还是使用已发布的镜像时。
技能链接
https://github.com/coleam00/Archon/blob/dev/.claude/skills/docker-extend/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我把我常用的命令行工具添加到这个项目的 Docker 容器中。”
每周 5 个新技能,1 分钟读完。
工作原理
技能会先检查项目是从源代码构建还是使用已发布的镜像,然后只创建或编辑你个人的覆盖文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Docker Extend
Sets up personal Docker tool customization using the project's gitignored override pattern.
Your Dockerfile.user and docker-compose.override.yml are yours — never committed to git.
Step 1: Detect Context
Determine if the user is in dev (source build) or deploy (GHCR) mode:
!if [ -f docker-compose.yml ] && grep -q 'build: \.' docker-compose.yml 2>/dev/null; then echo "DEV_MODE: Building from source (root docker-compose.yml)"; elif [ -f deploy/docker-compose.yml ]; then echo "DEPLOY_MODE: Using GHCR image (deploy/docker-compose.yml)"; else echo "UNKNOWN_MODE: No docker-compose.yml found in root or deploy/"; fi
Decision:
DEV_MODE→ work withDockerfile.user+docker-compose.override.yml(repo root)DEPLOY_MODE→ work withdeploy/Dockerfile.user+deploy/docker-compose.override.ymlUNKNOWN_MODE→ ask the user which directory theirdocker-compose.ymllives in before proceeding
Step 2: Check Current State
DEV_MODE — check root files:
!echo "=== Dockerfile.user ===" && (cat Dockerfile.user 2>/dev/null || echo "(not found — will create from example)") && echo "" && echo "=== docker-compose.override.yml ===" && (cat docker-compose.override.yml 2>/dev/null || echo "(not found — will create from example)")
DEPLOY_MODE — check deploy/ files:
!echo "=== deploy/Dockerfile.user ===" && (cat deploy/Dockerfile.user 2>/dev/null || echo "(not found — will create from example)") && echo "" && echo "=== deploy/docker-compose.override.yml ===" && (cat deploy/docker-compose.override.yml 2>/dev/null || echo "(not found — will create from example)")
If both files already exist: Skip to Step 4 (add tools). If files are missing: Proceed to Step 3 (copy from examples). If example files are missing too: Tell the user the project hasn't added the example files yet and to check with the maintainers or the docs.
Step 3: Copy Example Files
Run only the copy commands for whichever files are missing. Do NOT overwrite existing files.
DEV_MODE:
# Only if Dockerfile.user does not exist:
cp Dockerfile.user.example Dockerfile.user
# Only if docker-compose.override.yml does not exist:
cp docker-compose.override.example.yml docker-compose.override.yml
DEPLOY_MODE:
# Only if deploy/Dockerfile.user does not exist:
cp deploy/Dockerfile.user.example deploy/Dockerfile.user
# Only if deploy/docker-compose.override.yml does not exist:
cp deploy/docker-compose.override.example.yml deploy/docker-compose.override.yml
After running the copy commands, confirm to the user which files were created.
Step 4: Add Tools
Parse $ARGUMENTS for tool names (space-separated, e.g., vim ripgrep jq).
If tools were specified: Edit the appropriate Dockerfile.user to add (or uncomment) the RUN apt-get install block with the requested packages. Use the Edit tool — do not rewrite the entire file.
The block to add/modify:
RUN apt-get update && apt-get install -y --no-install-recommends \
<tool1> \
<tool2> \
&& rm -rf /var/lib/apt/lists/*
If no tools were specified: Show the user the file and ask which tools they want to add. Then edit the file accordingly.
Step 5: Rebuild
Show the user the rebuild command for their context. Do NOT run it automatically.
DEV_MODE:
docker compose build && docker compose up -d
DEPLOY_MODE:
cd deploy && docker compose build && docker compose up -d
Summary
Tell the user:
- Which files were created (if any)
- Which tools were added to
Dockerfile.user(if any) - The rebuild command to run when ready
- A reminder that
Dockerfile.useranddocker-compose.override.ymlare gitignored — they're personal and won't be committed
常见问题
我的更改会通过 git 共享吗?
不会。个人文件已被 gitignore 忽略,会留在你的电脑上。
它同时适用于开发环境和部署环境吗?
适用。它涵盖从源代码构建和使用已发布镜像两种设置,若无法判断属于哪种,会询问你。
它会修改哪些文件?
只修改你个人的 Dockerfile.user 和 docker-compose.override.yml。如果文件缺失,它会根据示例文件创建。
详情
作者的原始描述
Use when: User wants to extend Docker with custom tools, personalize the Docker environment, or set up user-specific Docker customization. Triggers: 'extend docker', 'docker-extend', 'add tools to docker', 'customize docker', 'add my tools to the container', 'personalize docker setup', 'docker user setup', 'install tools in docker'. Does: Interactively sets up Dockerfile.user and docker-compose.override.yml so users can add personal tools to their Docker environment without affecting maintainer files or committing user-specific config to git.
repo: coleam00/Archon
热度
- GitHub 星标
- 24k
- 排名
- #10122
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …