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
3 tasks done
braun-viathan opened this issue May 2, 2025 · 0 comments · May be fixed by #876
Open
3 tasks done

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 #876

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])

Why now?

  • as the development of the rust version with stable sandbox features for all OS will run smooth this enhancement will unify the conainerized linux to the mac sandbox. As Users will also have a persitent config and session logs while running the TS version of codex in a container.

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.

Checklist

  • implementation
  • passes pnpm test && pnpm lint && pnpm typecheck
  • Examples in run_in_container.sh “Linux sandbox” section updated

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 added a commit to braun-viathan/codex-cli that referenced this issue May 9, 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 9, 2025 that will close this issue
4 tasks
braun-viathan added a commit to braun-viathan/codex-cli that referenced this issue May 12, 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 added a commit to braun-viathan/codex-cli that referenced this issue May 12, 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 added a commit to braun-viathan/codex-cli that referenced this issue May 16, 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 added a commit to braun-viathan/codex-cli that referenced this issue May 20, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant