Skip to content

feat(run_in_container): optionally mount ~/.codex so Linux users keep configs & logs #789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks
braun-viathan opened this issue May 2, 2025 · 0 comments · May be fixed by #857
Open
4 tasks

feat(run_in_container): optionally mount ~/.codex so Linux users keep configs & logs #789

braun-viathan opened this issue May 2, 2025 · 0 comments · May be fixed by #857

Comments

@braun-viathan
Copy link

braun-viathan commented May 2, 2025

What problem does this solve?

  • On Linux Codex runs inside scripts/run_in_container.sh.
    Inside the container Codex looks for configs at /home/node/.codex (instructions, approval presets, session logs).
    Because the host $HOME/.codex is not bind‑mounted today, every container start loses those files — users cannot persist settings or share them between runs. 

Proposed solution

  1. Add a conditional bind mount in run_in_container.sh
    if [[ -e "$HOME/.codex" ]]; then
      docker_flags+=("-v" "$HOME/.codex:/home/node/.codex:ro")
    fi```
    
         *No directory ⇒ no mount ⇒ zero breakage.*
  2. Allow an override flag --config PATH so power‑users can point to an alternative folder/file (future‑proof for dot‑file minimalists). ([GitHub][1])
  3. Keep the mount read‑only; the container already writes logs under /home/node/.codex/log, which is safe. ([GitHub][2])

Relationship to #781 / #783

Why now?

Acceptance criteria

  • run_in_container.sh mounts $HOME/.codex when present.
  • Codex inside the container loads the user’s config.json and shows the chosen approval mode in the banner.
  • Script behaves exactly as before when the directory is absent.
  • New Vitest e2e verifies that a temp config file becomes visible inside the container. (Tests folder already exists ([npm][7]))

Checklist

  • implementation
  • unit / e2e test
  • README “Linux sandbox” section updated
  • passes pnpm test && pnpm lint && pnpm typecheck

Happy to submit the accompanying PR once #783 lands. 🚀

braun-viathan added a commit to braun-viathan/codex-cli that referenced this issue May 7, 2025
Enables users to persist Codex CLI configuration
across container runs by optionally mounting their
local `.codex` directory using the `--config` parameter.

Fixes openai#789
@braun-viathan braun-viathan linked a pull request May 7, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant