A general-purpose Ubuntu Docker image for running opencode. Published to Docker Hub as sprisa/opencode:<version> where <version> matches the release pinned in version.txt.
| Layer | Details |
|---|---|
| Base OS | ubuntu:26.04 |
| User | opencode (uid/gid 1000), passwordless sudo |
| opencode | Pinned in version.txt as OPENCODE_VERSION build arg |
| Build tools | build-essential, pkg-config (for native npm addons, pip source builds) |
| Python 3 | Lazy-installed via mise (see table below) |
| Homebrew | Linux-native Homebrew (/home/linuxbrew/.linuxbrew) — brew on PATH |
| mise | Dev tool manager — tools listed below install on first use via brew backend |
| CLI utilities | git, curl, jq, less, unzip, ssh client |
| Init | tini as PID 1 (zombie reaping, clean shutdown) |
These tools install on first use (via mise → Homebrew):
| Tool | Command | Backend |
|---|---|---|
| GitHub CLI | gh |
brew |
| GitLab CLI | glab |
brew |
| Ruby | ruby |
brew |
| ripgrep | rg |
brew |
| fd | fd |
brew |
| Wget | wget |
brew |
| Vim | vim |
brew |
| Micro | micro |
brew |
| Nano | nano |
brew |
| Python 3 | python3 |
brew |
| Node.js | node |
brew |
The image ships with a system config at /etc/mise/config.toml with these pre-approved tools. Users can add or override tools by creating ~/.config/mise/config.toml — mise merges both.
docker run -it -p 4096:4096 -v $(pwd):/home/opencode sprisa/opencode:latestThe server starts on port 4096. Mount your project at /home/opencode to persist the entire home directory (dotfiles, config, and ~/workspace).
| Variable | Default | Description |
|---|---|---|
OPENCODE_PORT |
4096 |
Port the server listens on |
OPENCODE_SERVER_PASSWORD |
(none) | Optional auth password for the server |
OPENCODE_CORS_ORIGIN |
(none) | Optional CORS origin; omit to disable CORS |
With authentication:
docker run -it -p 4096:4096 \
-e OPENCODE_SERVER_PASSWORD=secret \
-v myproject:/home/opencode \
sprisa/opencode:latestWith CORS enabled for a specific origin:
docker run -it -p 4096:4096 \
-e OPENCODE_CORS_ORIGIN=https://myapp.example.com \
sprisa/opencode:latestCustom port:
docker run -it -p 8080:8080 \
-e OPENCODE_PORT=8080 \
sprisa/opencode:latestAll docker commands go through task which reads the pinned version from version.txt:
task docker:build # Build locally as sprisa/opencode:<version>
task docker:login # Docker Hub login (needs $DOCKER_USER / $DOCKER_PASS)
task docker:push # Push +latest and +<version> for amd64/arm64
task publish # Push, create GitHub Release with auto-generated notestask updateFetches the latest release from anomalyco/opencode on GitHub and writes it to version.txt.
- The
opencodeuser has passwordless sudo, so you cansu - opencode -c 'apt install <pkg>'inside the container. - The root filesystem is ephemeral; mount
/home/opencodeas the persistent volume for all user data (dotfiles, config, projects). The~/workspacesubdirectory is the default workdir. ~/.local/binis on PATH and user-writable, useful for dropping custom tools at runtime.- Node version can be switched at runtime with
n <version>(e.g.n lts). - Homebrew is installed under
/home/linuxbrew/.linuxbrew(outside the persistent volume). It uses its bundled portable Ruby — no system Ruby needed. - Lazy-installed tools (see table above): run any listed tool and mise auto-installs it via Homebrew on first use. The image ships defaults in
/etc/mise/config.toml; create~/.config/mise/config.tomlto add your own — mise merges both.