Skip to content

OpenCode

Run OpenCode in the container with your host credentials.

Set up

Run opencode auth login on the host first. Then use the files in examples/guides/opencode:

~/.config/isodev/config.yaml
# yaml-language-server: $schema=https://isodev.dyszkiewicz.me/config.schema.json
# OpenCode with your host credentials.
image: isodev-opencode:latest
build:
  context: image
volumes:
  # Provider credentials from `opencode auth login` on the host, copied into
  # each new container by hooks/opencode.sh.
  - type: bind
    source: ~/.local/share/opencode/auth.json
    target: /run/secrets/opencode-auth.json
    read_only: true
lifecycle:
  on_create:
    scripts:
      - file: hooks/opencode.sh
~/.config/isodev/image/Dockerfile
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
# mise installs tools to ~/.local/share/mise and puts them on PATH through its
# shims. /usr/local/bin comes first, so files mounted there win.
ENV PATH=/root/.local/bin:/usr/local/sbin:/usr/local/bin:/root/.local/share/mise/shims:/usr/sbin:/usr/bin:/sbin:/bin
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates curl git \
    && rm -rf /var/lib/apt/lists/*

# mise, which installs the tools.
RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh

# OpenCode, as a prebuilt binary from its releases.
RUN mise use --global aqua:anomalyco/opencode
~/.config/isodev/hooks/opencode.sh
#!/bin/sh
# Runs once in each new container.
set -eu
# Copy the host credentials into the container's own OpenCode data directory.
mkdir -p "$HOME/.local/share/opencode"
install -m 600 /run/secrets/opencode-auth.json "$HOME/.local/share/opencode/auth.json"

Each container gets a copy of the credentials, so its sessions and data stay private to it. After logging in again on the host, run isodev up --recreate to copy the new credentials.

Providers that read API keys from the environment work too: add the variables, such as ANTHROPIC_API_KEY, to lifecycle.on_exec.forward_env_vars.

Use it

isodev up --recreate
isodev exec opencode

With Paseo, install the provider and choose OpenCode ACP (Isodev):

isodev int paseo install-provider --type=opencode-acp
paseo reload --json

With Zed, run isodev int zed install-provider --type=opencode-acp.

Last updated on