Run Codex in Docker, sharing your project and selected global instructions and skills, with outbound traffic restricted to an explicit allowlist.
cd /path/to/project
agentbox- Fast to launch: one command reuses built images and starts Colima if needed.
- Familiar configuration: edit the usual
.codexfiles. Settings, login, and chats persist between disposable containers. - Recognizable projects: your working directory appears at the same absolute path inside Codex, keeping project context and history filtering meaningful.
- Limited host access: only selected files are mounted; a separate proxy controls outbound destinations.
Requires Homebrew, Colima, Docker Engine 28+, Compose with
up --wait, and Buildx. No Docker Desktop or Docker account required.
brew install colima docker docker-compose docker-buildx
colima startBoth global mount sources must exist and must not themselves be symlinks. Existing instructions and skills are preserved by these commands:
mkdir -p ~/.codex/skills
touch ~/.codex/AGENTS.mdFrom this repository's root:
bash install.shThe installer checks prerequisites, copies configuration into
~/.config/agentbox, installs ~/.local/bin/agentbox, and builds both images.
Add export PATH="$HOME/.local/bin:$PATH" to your shell startup file if needed.
Use bash install.sh --force to replace an existing installation and rebuild;
persistent state is preserved.
From a project directory:
agentbox login --device-auth
agentboxComplete login in your browser; device authentication
may need enabling in your account. Arguments pass through: agentbox resume,
agentbox --help, etc. Running from /, your home directory, or a parent of the
Agentbox configuration is refused.
| Host source | Container location | Access |
|---|---|---|
| Current project | Same absolute path | Read/write |
Volume agentbox_codex-state |
/home/node/.codex |
Read/write |
~/.codex/AGENTS.md |
/home/node/.codex/AGENTS.md |
Read-only |
~/.codex/skills |
/home/node/.codex/skills |
Read-only |
Edit global instructions and skills on your Mac. Project .codex/config.toml
and AGENTS.md are shared with the project. User-level config.toml lives in
the volume; your Mac's ~/.codex/config.toml is not synchronized.
To edit volume settings or configure Git, open a shell from your project:
AGENTBOX_WORKSPACE="$(pwd -P)" docker --context colima compose \
-f "$HOME/.config/agentbox/compose.yaml" run --rm agent bashInside, ~/.codex is the persistent container configuration directory.
Use HTTPS remotes and a fine-grained token limited to selected repositories, with Contents: Read and write for pushes. Inside the shell above:
git config --global user.name 'Your Name'
git config --global user.email 'you@example.com'
git config --global credential.https://github.com.helper \
'store --file /home/node/.codex/github-credentials'
git push --dry-runAt Git's prompts, enter your username and use the token as the password. The helper stores it in plaintext in the volume, readable by Codex. Never put tokens in commands, chats, or repository files. Git settings persist in the volume too.
The lethal trifecta combines sensitive data access, untrusted content, and consequential actions. Malicious input can redirect an agent into abusing its legitimate access.
| Risk | Agentbox constraint | Remaining exposure |
|---|---|---|
| Sensitive data access | Only project, selected global files, and state are mounted. | Project secrets, credentials, and shared chats remain readable. |
| Untrusted content | Squid restricts reachable destinations. | Project files and allowed sites can contain prompt injections. |
| Consequential actions | Container boundary and restricted outbound routing. | Codex can delete project files, upload to allowed sites, and use stored credentials. |
The agent has an internal network with an isolated gateway; only Squid also
joins the outbound network. HTTPS CONNECT on port 443 is allowed to these exact
hosts: api.openai.com, chatgpt.com, auth.openai.com, and github.com.
Other destinations, ordinary HTTP, and the private/local ranges listed in
proxy/squid.conf are blocked. Squid does not inspect HTTPS content.
Both containers run non-root, drop Linux capabilities, and use
no-new-privileges. No Docker socket is mounted. Docker supplies the outer
boundary; Codex runs with --sandbox danger-full-access and
--ask-for-approval on-request. This does not require approval for every action.
- Allowed sites can receive uploads. This setup narrows prompt-injection damage; it does not prevent prompt injection or data exfiltration to allowed sites.
- Chats and credentials share one volume across projects; path filtering is not
storage isolation. Host
~/.agentsand unshared symlink targets are unavailable. - Package repositories require explicit allowlisting at runtime. Image builds use normal Docker networking, outside that allowlist.
- Linux and concurrent sessions are untested. No container resource limits are configured; image and Codex versions are not pinned.
- Agent containers are disposable; state and the proxy persist. Removing the
state volume, including with
docker compose down -v, deletes login and chats.
To change allowed destinations, edit ~/.config/agentbox/proxy/squid.conf, then
recreate the proxy with other sessions stopped:
AGENTBOX_WORKSPACE="$(pwd -P)" docker --context colima compose \
-f "$HOME/.config/agentbox/compose.yaml" up -d --wait --force-recreate proxyCheck the macOS runtime and plugins:
docker --context colima info
docker --context colima compose version
docker --context colima buildx version
docker --context colima run --rm hello-worldCheck scripts without Docker (requires Python 3):
python3 tests/check_scripts.pyThese checks mock Docker; verify networking from the container shell separately:
curl -I --max-time 10 https://github.com # Allowed
curl -I --max-time 10 https://example.com # Proxy denial
curl --noproxy '*' -I --connect-timeout 5 https://1.1.1.1 # Connection fails