OpenCode Runs Shared Server in Docker
OpenCode’s official container image supports running a headless server on port 4096, allowing the TUI, Desktop, web UI, and other clients to connect to one remote backend. The setup is documented through OpenCode’s [`serve`](https://opencode.ai/docs/cli/) command and [GHCR package](https://github.com/anomalyco/opencode/pkgs/container/opencode).
This is a meaningful shift from local-only coding sessions toward a portable, shared agent service. The convenience is real, but exposing the server also exposes powerful filesystem and shell capabilities.
- –`serve --hostname 0.0.0.0 --port 4096` makes the container reachable by remote clients.
- –Persistent volumes can preserve projects, credentials, sessions, and configuration across restarts.
- –A shared backend reduces repeated startup and MCP initialization overhead.
- –Authentication is essential; use `OPENCODE_PASSWORD` or `OPENCODE_SERVER_PASSWORD` before exposing the port.
- –Pin image versions and use a VPN or reverse proxy rather than publishing an unauthenticated agent directly to the internet. ([deployment discussion](https://github.com/anomalyco/opencode/issues/55558))
DISCOVERED
1h ago
2026-11-06
PUBLISHED
2h ago
2026-11-06
RELEVANCE
AUTHOR
thdxr