Deploy Codex Box v0.147 | Remote Dev Machine Pinned, Logged In, Persistent
Codex CLI dev box: pinned version, prebuilt image, API key seeded
codex-box
Just deployed
/data
Deploy and Host Codex Box on Railway
Codex Box is a persistent remote development machine for the OpenAI Codex CLI. Deploy it, connect over Railway SSH (or from the Codex desktop app's SSH connection), and work from one environment that keeps your Codex login, sessions, repositories and installed tools across every redeploy.
The image is prebuilt and the Codex CLI version is pinned, so a deploy is an image pull rather than a full Ubuntu + Node + toolchain build, and redeploying never swaps the agent version underneath you.
About Hosting Codex Box
The service runs one Ubuntu 24.04 container with the Codex CLI 0.147.0, Node 22, the
Railway CLI (agent support enabled), GitHub CLI, git, git-lfs, tmux, ripgrep, fd, Python 3
and uv. A volume mounted at /data holds everything durable: $HOME and /root both
resolve to /data/home/user, Codex state lives in /data/home/user/.codex, and projects
live in /data/workspace. The container repairs the volume's ownership on boot, because
Railway mounts volumes as uid 0, and it refuses to start at all if no volume is attached —
without one, a redeploy silently erases your Codex login and your repositories.
Set OPENAI_API_KEY and the box authenticates itself before you ever connect. This matters
more than it sounds: Codex 0.147.0 does not read that environment variable at request
time, so a box that merely has the variable exported sends no credentials, retries five
times, and reports 401 Unauthorized: Missing bearer or basic authentication in header.
Codex Box writes the credential into auth.json at boot instead. If you would rather sign
in with your ChatGPT account, leave the variable unset and run codex login over SSH — an
existing interactive login is detected and never overwritten.
There is no public HTTP domain. The only way in is Railway SSH, which Railway authenticates against your account and your registered key.
Common Use Cases
- Keep long-running Codex work off a laptop and reachable from any machine
- Give an agent an isolated cloud environment with its own CPU, RAM and disk
- Deploy to Railway from inside the box with the preinstalled Railway CLI
- Keep repositories, credentials and agent tooling separate from a personal computer
Dependencies for Codex Box Hosting
- A Railway account with room for one service and one volume
- The Railway CLI installed locally, for SSH access
- An OpenAI API key, or a ChatGPT account to sign in with interactively
Deployment Dependencies
Implementation Details
Connect after deploying:
railway ssh
To use the Codex desktop app, register a key and add a named SSH host:
ssh-keygen -t ed25519 -C codex-box
railway ssh keys add --key ~/.ssh/id_ed25519.pub --name codex-box
railway ssh config --alias codex-box --identity-file ~/.ssh/id_ed25519
Then open the Codex desktop app, go to Settings > Connections > SSH, choose the host, and add it as a remote project.
Variables:
| Variable | Required | Purpose |
|---|---|---|
OPENAI_API_KEY | No | Seeds Codex API-key authentication at boot. Omit it to sign in interactively with codex login. |
To move the Codex CLI to a newer release deliberately, rebuild the image with a different
CODEX_VERSION build argument, or run npm install -g @openai/codex@ inside the
box — npm -g installs land on the volume and survive redeploys.
Why Deploy Codex Box on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Codex Box on Railway, you get a persistent agent workstation with a volume, private networking and SSH access managed for you, so the environment your agent works in is one deploy away from anywhere.
Template Content
