
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
https://img.shields.io/docker/pulls/sprisa/opencode](https://hub.docker.com/r/sprisa/opencode) https://img.shields.io/docker/image-size/sprisa/opencode](https://hub.docker.com/r/sprisa/opencode) https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opencode-server](https://artifacthub.io/packages/search?repo=opencode-server)
A general-purpose Ubuntu Docker image for running https://github.com/anomalyco/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 |
| Lazy Installed Tools | Node, Python3 (see below) |
| Homebrew | Linux-native Homebrew (/home/linuxbrew/.linuxbrew) — brew on PATH |
| zerobrew | Faster Homebrew alternative (zb on PATH) -- used as mise backend for lazy-installed tools |
| mise | Dev tool manager — tools listed below install on first use via zerobrew backend |
| CLI utilities | git, curl, less, unzip |
| Init | tini as PID 1 (zombie reaping, clean shutdown) |
These tools install on first use (via mise → github/zerobrew):
| Tool | Command | Backend |
|---|---|---|
| GitHub CLI | gh | github |
| jq | jq | github |
| GitLab CLI | glab | zerobrew |
| Ruby | ruby | zerobrew |
| ripgrep | rg | github |
| fd | fd | github |
| Wget | wget | zerobrew |
| Vim | vim | zerobrew |
| Micro | micro | github |
| Nano | nano | zerobrew |
| Python 3 | python3 | zerobrew |
| Node.js | node | core |
| Sapling | sl | github |
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.
bashdocker run -it -p 4096:4096 -v $(pwd):/home/opencode sprisa/opencode:latest
The 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:
bashdocker run -it -p 4096:4096 \ -e OPENCODE_SERVER_PASSWORD=secret \ -v myproject:/home/opencode \ sprisa/opencode:latest
With CORS enabled for a specific origin:
bashdocker run -it -p 4096:4096 \ -e OPENCODE_CORS_ORIGIN=https://myapp.example.com \ sprisa/opencode:latest
Custom port:
bashdocker run -it -p 8080:8080 \ -e OPENCODE_PORT=8080 \ sprisa/opencode:latest
All docker commands go through task which reads the pinned version from version.txt:
bashtask 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 notes
bashtask update
Fetches the latest release from https://github.com/anomalyco/opencode on GitHub and writes it to version.txt.
opencode user has passwordless sudo, so you can su - opencode -c 'apt install <pkg>' inside the container./home/opencode as the persistent volume for all user data (dotfiles, config, projects). The ~/workspace subdirectory is the default workdir.~/.local/bin is on PATH and user-writable, useful for dropping custom tools at runtime.n <version> (e.g. n lts)./home/linuxbrew/.linuxbrew (outside the persistent volume). It uses its bundled portable Ruby — no system Ruby needed.zb) is installed at /usr/local/bin/zb with its prefix at ~/.local/share/zerobrew/prefix on PATH for accessing formula ***aries./etc/mise/config.toml; create ~/.config/mise/config.toml to add your own — mise merges both.Use in production at [***]
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 sprisa/opencode 相关的常用 Docker 镜像,适用于 不同场景 等不同场景: