Run OpenCode inside a rootless Podman container, isolating it from the host filesystem while keeping the workflow low-friction.
- Builds a Debian Stable image with OpenCode, zsh, and common project tools.
- Provides an
ocshell alias that enters a container for the current Git project. - Mounts only the project, OpenCode config, and OpenCode state database.
- Uses one persistent container per project.
cd ~/Git/Mine/containerized-coding
podman build -t opencode -f Containerfile .
echo 'source ~/Git/Mine/containerized-coding/alias.sh' >> ~/.zshrc
source ~/.zshrccd ~/Git/Mine/homelab
oc- Rootless Podman
- zsh
- A Git project
Alternative to the Podman setup. Sources your live OpenCode config directly via read-only bind-mounts instead of baking a copy into the image.
docker build -t opencode -f Dockerfile .
echo 'source ~/Git/TOOLS/containerized-coding/alias-docker.sh' >> ~/.zshrc
source ~/.zshrcSource either alias.sh (Podman) or alias-docker.sh (Docker) — both
define oc.
cd ~/Git/Mine/homelab
oc- Requires rootless Docker (
docker-ce-rootless-extras). Container root maps to your host UID:/workspacefiles stay yours, and a container escape lands as your unprivileged user — not root. - Config is mounted live, read-only from
~/.config/opencode(plus theagentssymlink target) instead of copied in. Edit config on the host, it's instantly live — no rebuild. - Sessions and auth persist via
~/.local/share/opencode(RW), same as Podman.
- Rootless Docker
- zsh
- A Git project
docs/DESIGN.md— full design and trade-offs.