Security-focused Docker container for running OpenCode with restricted filesystem access and Docker-in-Docker support.
# From your project directory:
./path/to/opencode.sh
# Update to latest version
./path/to/opencode.sh update- Docker
- Docker socket accessible (
/var/run/docker.sock) - User in docker group (or equivalent)
On first run, the container builds with the latest OpenCode version. The version is stored in .opencode-version next to opencode.sh. Subsequent runs use the stored version (no automatic update checks). Run ./path/to/opencode.sh update to update to the latest version.
Run opencode.sh from the project directory you want to work on. The current working directory is mounted into the container, allowing OpenCode to access and edit only that project.
- Project directory (current working directory, mounted at same path)
~/.config/opencode/- OpenCode settings and API key~/.ssh/configand~/.ssh/sockets- SSH access (OpenCode can SSH without password or key through existing connections shared via ControlPath)/var/run/docker.sock- Docker daemon (for running tests)/tmp/.X11-unix- X11 forwarding (clipboard)