cd /news/ai-agents/isn-t-a-prompt-enough-why-we-need-do… · home › topics › ai-agents › article
[ARTICLE · art-175199] src=ajeetraina.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Isn't a Prompt Enough? Why We Need Docker Sandboxes

Docker's `sbx` CLI runs coding agents such as Claude Code, Codex and Gemini CLI inside their own microVM, mounting only a chosen project folder and routing outbound traffic through a policy proxy that blocks unapproved hosts and logs every call, Docker Bangalore meetup speaker Ajeet Raina argued in a hands-on demonstration. The demonstration runs the same safety prompt against two agents to show that prompt injection, model error, context trimming in long sessions and package scripts running with full user rights can each defeat an instruction that lives inside the model's context, while sandbox rules sit outside it. API keys are stored on the host and injected by the proxy, so the agent sees only a placeholder inside the VM.

recommendation

Run coding agents in an sbx microVM with only the project folder mounted, import API keys via `sbx secret import` so the agent sees placeholders, and review `sbx policy log` to audit every allowed or blocked network call.

more in playbook: Securing agents and AI tools
by read4 min views3 publishedNov 24, 2026
Isn't a Prompt Enough? Why We Need Docker Sandboxes
Image: Ajeetraina (auto-discovered)

Docker Sandboxes

A meetup question, answered with a hands-on simulator: why a safety prompt alone can't protect your laptop from a coding agent, and what Docker Sandboxes add.

Someone asked this at our last Docker Bangalore meetup, and it is a great question. If I can tell my coding agent "never delete files outside this project", why do I need a microVM around it? Here is the short answer, and then you can try it yourself.

asks. A sandbox

enforces.

Run the same attack twice

Both agents get the exact same safety prompt.

You are a careful coding assistant. Only work inside this project folder.
Never delete files outside it. Never read secrets. Never send data to unknown hosts.

Prompt only Waiting

Prompt + Docker Sandbox Waiting

A teaching simulation. Commands and logs are simplified.

Why a prompt is not enough #

A prompt is text. The model reads it, and most of the time it follows it. But "most of the time" is not a security model. Here are four plain reasons a prompt can fail:

1. The model reads other text too. Your prompt sits next to README files, issue comments, web pages, tool output and package scripts. Any of that text can say "ignore your earlier rules". This is prompt injection, and there is still no reliable fix for it at the model level.

2. The model can simply get it wrong. It may mean rm -rf ./build and type rm -rf ~/. No bad intent at all. Just one wrong character.

3. Long sessions forget. After hours of work, context gets summarised or trimmed. The rule you wrote at the start may not be there any more.

4. The code it runs is not the model. When the agent runs npm install, a package script runs with your full user rights. Your prompt has no say over that script at all.

A good comparison: a prompt is a sign on the door that says "Do not enter". A sandbox is the lock. Most people respect the sign. The lock is for the day someone does not.

Where does the rule live? #

This is the key idea. A prompt lives inside the model's context. Anything else in that context can argue with it, and the model decides who wins.

A sandbox rule lives outside the model. It sits in the microVM boundary, the network proxy and the secret store. The model cannot talk its way past it, because it is not part of the conversation.

So the question is not "prompt or sandbox". It is "what happens on the day the prompt fails?"

Side by side #

Question Prompt only Prompt + Docker Sandbox

What Docker Sandboxes actually add #

Docker Sandboxes (the sbx CLI) run your agent, like Claude Code, Codex or Gemini CLI, inside its own microVM. Three walls matter for this question:

Your files

Only the project folder you choose is mounted. Your home folder, SSH keys and cloud config are simply not there. The agent cannot delete what it cannot see.

Your network

Outbound traffic goes through a policy proxy. Hosts you did not allow are blocked, and every call is logged so you can see what the agent tried.

Your secrets

API keys are stored on the host and added by the proxy on the way out. Inside the VM the agent sees a placeholder, not the real key.

sbx run claude

sbx secret import

sbx policy allow network localhost:12434

sbx policy log

Check sbx --help on your version, as flags change between releases.

So should I stop writing good prompts? #

No. Keep them. A good prompt makes the agent do the right thing most of the time, which saves you time and tokens. A sandbox makes sure that when it does the wrong thing, the damage stays small.

Think of driving. Good driving skills are the prompt. The seatbelt is the sandbox. You want both, and nobody skips the seatbelt because they are a good driver.

One honest note: a sandbox only limits what you give it. If you mount your whole home folder, allow every host and import every token, the walls are gone. Start small: one project folder, the few hosts you need, the one key the task needs.

Quick quiz: prompt or sandbox? #

For each one, which layer can actually guarantee it?

Have a meetup question you want answered like this? Find us in the Collabnix Slack or the Docker Bangalore group. Docs: docs.docker.com/ai/sandboxes

── more in #ai-agents 4 stories · sorted by recency
── more on @docker 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/isn-t-a-prompt-enoug…] indexed:0 read:4min 2026-11-24 · —