container: Forward env vars by prefix and source shell config from container-home

Replace hardcoded env var lists with prefix-based forwarding (OPENCODE_*,
ANTHROPIC_*, CLAUDE_*) so new env vars are picked up automatically.

Run tools through bash -l inside the container so that .bashrc, .bash_profile,
and .profile from container-home are sourced. Seed container-home with default
shell config from /etc/skel on first run if the files don't already exist.
This commit is contained in:
Jeena 2026-03-31 04:26:20 +00:00
parent d6f179ec57
commit a3db357b6f
2 changed files with 51 additions and 26 deletions

View file

@ -35,9 +35,16 @@ The container home directory at `$XDG_DATA_HOME/agent-container/container-home/`
## Environment Variables
Host environment variables matching the following prefixes are automatically forwarded into the container:
- `OPENCODE_*` -- passed through to OpenCode
- `ANTHROPIC_*`, `CLAUDE_*` -- passed through to Claude Code
This means inline overrides work as expected: `OPENCODE_CONFIG=foo opencode`
For persistent environment variables, add them to `container-home/.bashrc` (or `.bash_profile` / `.profile`). Tools run through `bash -l` inside the container, so standard shell config files are sourced automatically. Default shell config files from `/etc/skel` are seeded into the container home on first run.
- `XDG_DATA_HOME`: Override default data directory (default: `~/.local/share`)
- `ANTHROPIC_API_KEY`: Your Anthropic API key (passed through to Claude Code)
- `ANTHROPIC_BASE_URL`: Override the API base URL (optional, passed through to Claude Code)
## Usage