I use nixos and use a little wrapper that wraps Codex CLI in Docker. Run codex-box /path/to/project and it starts or reuses a container with only that project bind-mounted, keeping login and history in a separate volume. It uses tmux for detaching and reattaching
https://gist.github.com/entropie/8f30b9e33e9412fda3adf2f7507...
But I am not satisfied. I am trying to find a really lightweight container/VM for macOS that eats very less RAM on its own and expands as needed. Because I really don't want to run an agent outside a container on my mac.
Maybe thats just the tool nerd in me that just wants the perfect tool for every job.
The thing that really validated this point was when I recently tried Codex again. Out of the box it was OK, but not great. I swung over the memory apparatus and had it import directives from my existing Claude install and it was almost immediately quite useful in its own right and, especially, as a counterpoint to Claude when dealing with some fairly complex operational issues.
This blogpost describes a similar thing: https://bxt.rs/blog/easy-sandboxing-on-linux-with-bubblewrap...
Maybe it's like online services/tools. Use them until they are VCed and gone pivoting and then move to another tool.