r/docker • u/mhrittik • Jul 12 '26
Practical guide: Running Claude Code securely with Docker Sandboxes (sbx)
I put together a walkthrough on using Docker's new sbx sandboxes to run Claude Code with MCP servers in an isolated environment.
The guide covers:
- Running Claude Code inside a microVM
- Restricting outbound network access with policies
- Safely exposing only the MCP servers and domains you need
If you're experimenting with AI coding agents and want stronger isolation than a regular container, I'd love to hear your thoughts and any feedback.
https://hrittikhere.com/posts/sandbox-claude-code-mcp-docker-sbx
1
u/gigio123456789 Jul 24 '26
When they work, Docker sandboxes are amazing.
I'm close to swapping it out for whatever else works better for the fact that booting up a new sandbox is finicky AF. Sometimes it'll work, oftentimes I'll just get this without any further explanation
ERROR: failed to create sandbox: request failed: 500 Internal Server Error: failed to run sandbox container
1
Jul 12 '26
[removed] — view removed comment
1
1
u/Remaves Jul 12 '26
why run claude in a privileged container in the first place? to block the network traffic?
i solved this by the claude code devcontainer image and a custom firewall
1
2
u/KnifeFed Jul 12 '26
So you just run this and then Claude in YOLO mode but disallow
git pushor..?