Fix container username and home mount

This commit is contained in:
Jeena 2026-01-21 23:58:15 +09:00
parent fc2e5b1bca
commit c387a7a365
4 changed files with 35 additions and 11 deletions

View file

@ -9,7 +9,7 @@ the host.
- Arch Linuxbased image
- Runs as the host user (same username, UID, GID)
- Mounts only the current project directory (same absolute path inside container)
- Persists OpenCode state in ./container-home directory
- Persists OpenCode state in XDG_DATA_HOME/opencode-container/container-home directory
- No access to SSH keys, passwords, or full `$HOME`
- Simple shell function (`opencode`) to launch interactively
@ -24,10 +24,14 @@ git clone https://git.jeena.net/jeena/opencode-container.git
Source the helper file `opencode.aliases` in your shell configuration
(`.bashrc` or `.zshrc`) so the `opencode` function is available in new sessions.
We set up the ./container-home directory as a central $HOME inside of the
We set up the XDG_DATA_HOME/opencode-container/container-home directory as a central $HOME inside of the
container, independent of the session or project directory we start in. This
presists the whole $HOME from inside the container so everything opencode
writes into config files, etc. presists there.
persists the whole $HOME from inside the container so everything OpenCode
writes into config files, etc. persists there.
## Environment Variables
- `XDG_DATA_HOME`: Override default data directory (default: ~/.local/share)
## Usage