Milan Jovanović runs Claude Code on an Ubuntu VPS inside a Docker dev container with a default-deny firewall, then hands it .NET tasks from his phone via Remote Control. Here is the full setup.
Key points
- The agent runs as a non-root `claude` user, since bypassPermissions mode refuses to work as root.
- `init-firewall.sh` fires on every container start and drops outbound traffic outside the allowlist.
- The default DOMAINS list holds Anthropic endpoints, api.nuget.org and learn.microsoft.com, plus your git host.
- WebSearch survives the firewall because searches run on Anthropic's backend; WebFetch goes out from the container and gets blocked.
- Allowlisted names are re-resolved every ten seconds so CDN address changes do not break the setup.
- Remote Control requires the subscription login rather than an API key, and must run inside tmux to outlive SSH.
Why it matters
Anyone who lets an AI agent work unattended eventually asks what it could reach if it misbehaves, and this post turns that question into a concrete configuration. With prompts disabled the container's network policy is your only real brake, so every host added to the allowlist deserves a conscious decision and a note of why. Check the resource budget before copying it: 4 GB is the floor for Claude Code alone, while `dotnet build`, tests and a database share the machine. Also accept that widening the allowlist means rebuilding the container, and that the tmux session becomes part of your infrastructure.
Real-world use
- Handing the agent a task from your phone and closing the laptop while it keeps building on the server.
- A .NET 11 Minimal API plus test project that the agent writes and verifies while you are away.
- A dashboard on port 5080 that only you reach over an SSH tunnel, never exposed to the internet.
- Letting the agent read current learn.microsoft.com docs for a library whose API changed after training.
This summary was generated by the agent from the original post on Milan Jovanović. The full text and all rights belong to its author and publisher. Go to original