---
title: "Deploy Claude Code Box"
description: "Ubuntu with Claude Code, Codex and Gemini CLI. Browser terminal and SSH"
category: "AI/ML"
url: https://railway.com/deploy/claude-code-box
---

# Deploy Claude Code Box

Ubuntu with Claude Code, Codex and Gemini CLI. Browser terminal and SSH

**[Deploy Claude Code Box on Railway](https://railway.com/template/claude-code-box)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/claude-code-box/manifest.json

- **Creator:** Dektion Studio
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### coding-box https://devicons.railway.com/i/ubuntu.svg

- **Source:** dektionstudio/railway-template-images
- **Public domain:** Yes

## Documentation

# Deploy and Host Claude Code Box on Railway

An Ubuntu 24.04 box with Claude Code, Codex and Gemini CLI installed. You get a password-protected terminal in the browser plus SSH, your home directory lives on a Railway volume, and a tmux session keeps an agent working after you close the tab.

I made it because the most deployed Claude box on Railway has no volume, so your Claude login and every file you created are gone after a redeploy. Here the home directory is the volume. This is a community template; it isn't made by Anthropic, OpenAI or Google.

## About Hosting Claude Code Box

When the deploy finishes, open `BOX_URL` from the Variables tab and log in as `dev` with `BOX_PASSWORD`. You land in a tmux session. Then log in to the agents you use:

```bash
claude                      # log in with your Claude subscription, or set ANTHROPIC_API_KEY
codex login --device-auth   # or set OPENAI_API_KEY
gemini                      # pick a login method, or set GEMINI_API_KEY
```

Close the tab and whatever runs in tmux keeps running. Open `BOX_URL` again and you're back in the same session. The terminal is a web page, so a phone browser can open it too.

For SSH, copy `SSH_COMMAND` (it looks like `ssh -p 12345 dev@something.proxy.rlwy.net`). It accepts `BOX_PASSWORD`, or put your public key in `SSH_AUTHORIZED_KEYS` and set `SSH_PASSWORD_AUTH` to `no`. Commands over SSH find the agents too, so `ssh ... claude -p "fix the failing test"` works from a script.

What I tested before publishing: the page returns 401 without the password; in the browser terminal `claude`, `codex`, `gemini` and `gh` all run; SSH with a key runs `claude`; and a file I wrote in the home directory was still there after the image was rebuilt and redeployed twice. A fresh deploy took about two and a half minutes, most of it building the image. Idle, the box used 6 MB of RAM. An agent uses more while it works, and I don't have a measured number for that.

## Common Use Cases

- Start a long Claude Code or Codex task in tmux, close the laptop, and check on it later from any browser
- Keep one Linux workspace with your repos and agent logins that you reach from every device

## Dependencies for Claude Code Box Hosting

An account or API key for each agent you use: Claude, ChatGPT or OpenAI, Google. The deploy itself needs no input.

### Deployment Dependencies

- Dockerfile and scripts: https://github.com/dektionstudio/railway-template-images/tree/main/coding-box
- Claude Code: https://docs.anthropic.com/en/docs/claude-code
- Codex CLI: https://github.com/openai/codex
- Gemini CLI: https://github.com/google-gemini/gemini-cli
- ttyd (the browser terminal): https://github.com/tsl0922/ttyd

### Implementation Details

Besides the agents the image has Node 24, Python 3, git, the GitHub CLI, tmux, ripgrep and build tools. Set `GITHUB_TOKEN` and `gh` plus `git push` over HTTPS work without a login step.

Only the home directory persists. This is a container, not a VM: `sudo apt install` works, but those packages disappear on the next redeploy, and there's no Docker or systemd inside. The agents sit in `/opt/agents`, owned by `dev`, so they can update themselves. A redeploy of the same image goes back to the versions it was built with; run `install-agents` to update all three.

The volume is 0.5 GB on Railway's trial and free plans and 5 GB on Hobby. Agent logins and a few repos fit in 0.5 GB, but npm and pip caches fill it quickly.

Anyone with `BOX_PASSWORD` gets a shell with sudo, and any API key you set as a variable is readable from that shell. Treat the password like an SSH key. Password login over SSH is on so the box works right away; switch to a key when you can.

## Why Deploy Claude Code Box on Railway?

An agent can run for hours without your computer staying on, and the same box is there from every device. You pay for the RAM it uses, which is next to nothing while it sits idle.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/claude-code-box
