为支持命令行运行的 LLM 工具创建沙箱环境还是有必要的,前段看到AI助手删库的……创建沙箱就可以让 LLM 不要再询问我执行不执行了,使用相关参数让其自动执行,自己只需要在满意的状态下自己 git commit 进行记录就行。对于 Claude Code 需要自己创建 Dockerfile ,Anthropic 官方仓库有样例,但是是针对 containercli 工具的,可以自己提取然后直接用docker/podman。

对于 gemini-cli ,他自己集成度比较高,直接使用 gemini-cli -r 就行。
这里针对 podman 提供一些配置思路。

# `--userns=keep-id`:  permission
# `--security-opt label=disable`: disbale selinux
export SANDBOX_FLAGS="--userns=keep-id --security-opt label=disable"
# Disable UID/GID mapping to prevent conflict with `--userns

Comments (0)

No comments yet. Be the first to share your thoughts!