This repository provides a reproducible, secure, and user-transparent Docker environment (the cpi command) for running the pi coding agent with full project/workstation integration.
- No files or config from user home are required except what you explicitly mount
- All session/config/secrets stay on host via explicit mounts (
.pi/,.gitconfig, etc.) - $HOME is a tmpfs RAM disk; no shell history, plugins or lingering files outside session
- UID/GID inside matches your host user, so there are no permission issues
- Starts interactive
zshwith oh-my-zsh and plugins pre-installed in the image (no sshfs overhead) tmuxavailable inside the container for pi sub-agent and background bash workflows- Always shows a
[cpi]indicator in the prompt when inside the container - Fully resets/corrects terminal state on exit/kill, even on
docker stopor crash - Clean separation—never sources shell configs from host (all is container-local)
- Secure: no arbitrary code ever mounts from host except as
:roor with explicit opt-in
-
Build the image:
docker build -t cpi:latest . -
Install the wrapper script system-wide:
sudo cp cpi /usr/local/bin/cpi
-
Use as a drop-in pi replacement (interactive, non-interactive, or scripted):
cpi # Interactive pi in container cpi -p "hello" # Print mode (no TUI)
--home-dirs# Mounts $HOME/Documents and $HOME/Downloads in the container--parent-dir# Mounts one level up from $PWD as working dir
- Set
OPENAI_API_KEY,OPENAI_BASE_URLbefore launchingcpi(recommended for OpenAI proxies) .pi/and.gitconfigare always mounted (for agent config and git identity)
- No dynamic sourcing of host files or bashrcs—safe against shell injection or config leakage
- UID/GID maintained, no root
- Breaking terminal state after
docker stopand other edge cases handled in script
-
To further customize shell: edit
entrypoint.shwhere it writes the inline.zshrc -
To add packages permanently: edit the
apk addblock inDockerfile -
To inject packages at build time without editing
Dockerfile:docker build --build-arg EXTRA_PACKAGES="python3 py3-pip" -t cpi:latest .
For usage, contributing, and troubleshooting, see this repository’s README. For advanced pi agent configuration and workflows, consult the upstream pi-coding-agent documentation or visit pi.dev.
This project is licensed under the MIT License.