Top
Best
New

Posted by etoxin 4 hours ago

Docker Sandboxes – Disposable, isolated sandboxes for AI agents(www.docker.com)
232 points | 148 comments
rusch 3 hours ago|
The login is annoying but, lacking an open source alternative, this has been my daily driver for a while now because it works great out of the box with two key features: outbound firewall and secret injection with placeholders.

I run it with superset and then each git worktree is mounted in a sandbox that is configured for each repo i work in.

Closest open source I have seen is https://earendil-works.github.io/gondolin but the DX is not as polished. https://exe.dev/ would be perfect but it does not come with outbound firewall.

Does anyone have a better alternative?

pbasista 7 minutes ago||
I use Linux Containers managed by Incus for working with Claude.

I have a dedicated container for that. It can run its own Docker daemon and other system services if needed.

Apart from the Claude login token, it has no SSH keys or other credentials. I push everything I need to it from the local machine. And I pull the Claude generated outputs from it.

Of course, this kind of setup requires a stack which can run or at least be tested without any credentials.

rpoisel 35 minutes ago|||
Don't want to say it's better, but I implemented Agent Circus (https://github.com/Embedded-Focus/agent-circus) which allows to lock AI agent harnesses into docker containers.

I'm using it as my main driver since months.

Support for running agent harnesses in unprivileged podman containers is on my feature list. :-)

jachris 2 hours ago|||
Agreed. Network control and secret injection together with a microVM setup is as good as it gets right now, although I believe that we need more fine-grained tools down the road. It sounds like Microsandbox would be the perfect fit for what you are describing. I also built my own coding agent workbench on top of it (https://github.com/isolade/isolade). Microsandbox is quite cool, check it out: https://github.com/superradcompany/microsandbox
devttyeu 1 hour ago|||
For persistent-ish one-off apps https://xbin.dev/ (my project)

Has egress and ingress filtering, egress can be bound to host/internet/subnet or even better to internal apps (which are each separate netns) meaning you can do your own firewall/vpn/whatever per sandbox. Plus you control what other components in the sandbox env the app can communicate with.

Really not built for day-to-day dev work though, more like automating your company/life / getting rid of SaaS (e.g. for technical Founders / Sales etc, not exactly useful for dev work)

SegmentTree 2 hours ago|||
Eclipse Enclave does exactly that: There is an outbound firewall and secret injections, so that the agent never sees a real key. And it's fully open source: https://github.com/eclipse-enclave/enclave
dvtkrlbs 2 hours ago||
Looking at the Readme it seems like it only supports docker. Which is a dealbreaker for some
collabs 19 minutes ago||
What is missing in qemu + podman that we need rootful docker for this? Is there actual capability that is missing or is it more of a design choice by the eclipse enclave folks?
nzjrs 45 minutes ago|||
If you just need a python+venv sandbox with dev-first UX, no container build step needed, and no startup cost then I am using https://github.com/nzjrs/sandbubble in prod.
binsquare 2 hours ago|||
maintainer, I would recommend trying out: https://github.com/smol-machines/smolvm

It has network filtering + placeholders for secrets.

OSS, no logins needed

reddec 1 hour ago||
I've put some effort to integrate it to my agentic workflow. The problem, however, with docker in smolvm: it work-ish (there is example), but quite hacky. Another problem which I wasnt able to solve - persistent image without Dockerfile. CloudInit will be ideal.

Documention at this moment in an early stage.

Overall, its a great project but for me was simpler just use Virtual Machine Manager (libvirt GUI).

I wish all luck to the maintainers, but probably DX-wise I will prefer to have more granular or predictable controls (eg micro cloud from Canonical).

mellowagain 38 minutes ago|||
ive been using https://github.com/Gerharddc/litterbox
throwaw12 2 hours ago|||
I havent used nor gondolin neither docker's solution, but curious to know what gondolin is missing (evaluating both for my personal use)? is it only the DX or something else, if DX, can you what exactly is missing?

thanks

rusch 2 hours ago||
Yes, the stated "target workload"[0] is not what i'm looking for. I want my agent to run for long, spin up dedicated local stack while developing etc.

It seems with gondoling i need to explain the agent to run commands in the sandbox, but then where does the agent run itself?

[0]: https://earendil-works.github.io/gondolin/workloads/

eli 1 hour ago||
You can run the agent in the gondolin sandbox if you wish.

Their example implementation with pi uses a pi extension so that pi runs on the host but the read/write/bash/etc tools run in the guest. Doesn’t have to be that way though.

MikhailTal 2 hours ago|||
https://github.com/e2b-dev/e2b
_ink_ 2 hours ago|||
Does secret injection really prevent that the agent send my GitHub key somewhere? If it has access to it via env var, can it not just paste it somewhere?
rusch 2 hours ago|||
The env var is just a placeholder in the VM, so no real secret is in there.
eli 1 hour ago|||
It’s injected into an outbound api call, not into an env var the agent can read.
kellpossible2 6 minutes ago|||
or an outbound call to a trusted endpoint with the env var in a way that can get exposed to the agent via a subsequent call?
kellpossible2 7 minutes ago|||
what's to stop an agent creating an outbound call with the var to a malicious endpoint? (unless you whitelist what it has access to)
petesergeant 1 hour ago|||
What specifically do you want? I have:

https://github.com/pjlsergeant/byre -- slightly different security model, but lazer-focused on developer experience; my daily driver and I love it not just because I wrote it. The TUI is great for configuring and setting up instant boxes just how you want

https://pleasedonotescape.com/ -- a list of every other agent jail I could find, filterable by open-source and whatever else you want

sparsesignal 2 hours ago||
What I run is one hardened QEMU/KVM VM per project holding the whole dev environment (editors, agents, containers), with nftables on the host allowing internet egress but dropping anything aimed at the host, the LAN, or any other private address, plus an allowlist for deliberate exceptions.

Basically, it's a plain QEMU/KVM VM on a stock Debian cloud image: device model stripped down to a virtio disk, a virtio NIC and a serial console, nested virt off, no passwordless sudo in the guest. It also ships a containment check that scans outward from inside the guest, so the network boundary is something you can verify.

Wrapping the whole environment rather than a single agent session puts supply chain attacks inside the boundary too. A poisoned npm or PyPI package, or a compromised editor extension, lands in the VM instead of on the host. That was the original reason I set this up; agents just made it more urgent.

There's no per-domain egress allowlist; the policy is "internet yes, private addresses no". Secret injection isn't built in either, though Infisical's agent-vault on the host as an egress proxy covers that part.

Wrote the whole setup up here, in case it's useful:

https://karamatli.com/posts/network-isolated-kvm-sandbox-ai-...

benguild 28 minutes ago||
Apple Container is an interesting work in progress: https://github.com/apple/container
Grimburger 3 hours ago||
> Each agent runs inside a dedicated microVM with your dev environment

What's a "microVM" and what's the security model here compared to using real virtual machines with actual constraints on breakouts?

Is it marketing fluff?

Incus/LXD has had VM's for a long time now.

    incus launch images:ubuntu/26.04 my-ubuntu-vm --vm
    incus exec my-ubuntu-vm -- bash
masklinn 2 hours ago||
“microvms” are real vms but the hypervisor and vm (guest kernel) shed most of the hardware / device emulation, support, and discovery which makes traditional VMs look / feel like real computers, as well as most guest interactions. This gives them extremely low overhead.

Firecracker is designed to start a VM in under 125ms and 5MB. Netbsd advertises that you can direct-boot a MICROVM kernel configuration in under 10ms.

jsiepkes 1 hour ago||
If an agent fires up NPM, takes a boatload of memory, is that memory released back to the OS after NPM shuts down in the VM?
dist-epoch 1 hour ago||
In principle yes, in practice it's complicated, using something called "balloon drivers"

https://en.wikipedia.org/wiki/Memory_ballooning

masklinn 1 hour ago||
There’s also memory hotplugging via virtio-mem. But generally speaking downscaling live vm memory can’t be said to be a solved problem, it’s more of an active area of research.
vdfs 1 hour ago|||
Your example is not complete, you have to show how it will run claude/codex, you have to do extra things to install run and mount folders there, this one does that with less config, also with this agents can run docker, lxd doesn't allow you to do that
TheqO 1 hour ago|||
There are many devs that have little to no experience of Linux, like the hundreds of thousands of .Net and Java CRUD devs in enterprise companies using Windows.

There is a need for a Docker desktop like GUI for this market.

Izmaki 57 minutes ago|||
When I was a teen I had no experience with software development. Then I went to school and learned about it. Now I'm making money doing this thing because I became quite good.

The world didn't fit around me, so I made "me" fit around "the world". I bet those stubborn dinosaurs can learn a new trick or two also, if management lets them do it during working ours...

RagnarD 37 minutes ago||||
Huh? https://docs.docker.com/desktop/setup/install/windows-instal...

Also, WSL (Windows Subsystem for Linux) has been baked into Windows for a long time and makes it very easy to play with Linux, as does using the Hyper-V VM system. Any developer unfamiliar with Linux because they use Windows, has little excuse.

huflungdung 1 hour ago|||
[dead]
frio 3 hours ago|||
It’s real VMs, firecracker style.
dist-epoch 1 hour ago|||
An Ubuntu Server VM, like the ones started by Incus, use at least 512 MB of RAM per instance. If you spawn 10 sandbox VMs, you already pay 5 GB RAM just to sit there idle. You also pay a CPU cost, you have 10 kernels managing stuff, but arguably it doesn't matter that much given CPU core counts.

I use something in between - a single Ubuntu VM, into which I spawn multiple Incus LXC containers for the agents. The containers only use 50 MB or so per instance (separate systemd, ...). This way I pay the VM RAM tax only once, and the agents are still contained inside the VM if they manage to escape the LXC containers.

dizhn 2 hours ago|||
That's a full VM. Microvms are much smaller and they start up very very fast. In miliseconds.
randomint64 2 hours ago||
[dead]
hokkos 3 hours ago||
Wow, I hope one day Linux will be able to support the exclusive MacOs/Windows technology of Docker Sandboxes.

(it's in the doc, but kinda strange to not see some instructions on the main page, probably distro related)

crabmusket 3 hours ago||
There's always https://github.com/mensfeld/code-on-incus
stefanka 3 hours ago|||
What about bubblewrap? It also provides a sandbox
SwellJoe 1 hour ago||
Yes, bubblewrap is superior to Docker for this. I wrote a tool to use bubblewrap for the purpose. It needs a tool to start it, or is at least much more convenient with a tool, because you need to take your session/auth data into the container, and if you want the agent to be able to start containers (agents love containers) within the container, you need some config magic mounted inside. You could manually do all that, or do it with a shell script, as well. But, this is how I did it, and you're likely to run into all the same little quirks I ran into:

https://github.com/swelljoe/flar

ai_fry_ur_brain 3 hours ago||
[dead]
sureglymop 2 hours ago||
What is the main benefit over doing something like:

    docker run --runtime krun --rm -it -v $(pwd):/workspace/$(basename $(pwd)) -w /workspace/$(basename $(pwd)) --network restricted-net ghcr.io/openai/codex-universal:latest sh
That runs the codex OCI in a qemu microvm. From what I can see, more fine grained network and filesystem access control as well as convenience?
defraxi 1 hour ago|
The credentials part...

https://docs.docker.com/ai/sandboxes/security/credentials/

ShinyLeftPad 33 minutes ago||
It seems to do a good job of not stating the actual threat model anywhere.
navigate8310 3 hours ago||
I just made my own devcontainer that I copy on any project and load whatever harness I want in that repo. Harnesss' config and auth are simply mounted from the host, so no setup required at all.

https://github.com/iodize6399/ai-devcontainer/tree/main/.dev...

anentropic 32 minutes ago||
Yeah I also recently started using devcontainers for this

I quite like the 'features' layer system, adding extra tools to container in a declarative plugin-like way

Being able to 'safely' run with skip permissions has been a gamechanger

ai_fry_ur_brain 2 hours ago||
[dead]
d2p 1 hour ago||
Does this support Linux yet? When I previously looked it did not (the reason being that they were already using VMs on Windows/macOS but not on Linux). Every time I see an announcement I think "great, they must've added Linux now then", but the linked pages always have Windows + macOS instructions but not Linux.

All the open GH issues about supporting Linux that I subscribed to have gone unresponded to.

OpenShell looks like a good alternative, but it still has "Do not use in production" plastered all over the website, which doesn't fill me with confidence yet

SwellJoe 1 hour ago||
I think Linux has a better solution than Docker.

I wrote a tool to use `bubblewrap` to containerize any agent (at least all the agents I've used a couple of times), and bind mount the system stuff read-only, so the agent has your "usual" environment, but they can only see the project. Their history persists (either through a bind mount or a "shadow" copy of the history that only the wrapped agent sees), the agent can still create and manage containers of its own using podman's rootless mode, etc. It's nearly instant to start because it's just a namespace (plus a few copied files for the container support and session history); no container needs to be built/fetched/updated/whatever. bubblewrap is extremely well-tested as it is used by flatpak and several other large projects, so I trust it quite a bit (more than I trust Docker).

https://github.com/swelljoe/flar

Narushia 54 minutes ago|||
I was able to install it on Fedora from the .rpm distributed on their GitHub releases: https://github.com/docker/sbx-releases/releases
duxuev 1 hour ago|||
I also hit the same issue recently. No Linux and no Windows on arm. AI sandboxing has a lot of options but none feel complete just yet. It's hard to commit to something, especially if reviewing tools to aide in company policies.

Regardless, I'm hoping something that isn't behind a login screen is going to win out.

narinciye 56 minutes ago||
It must be a joke that this tool is not supported on linux yet, although docker is built on top of linux containers. Shame on docker.
karakanb 3 hours ago||
I got excited for this not because this didn't exist before, but because Docker putting their weight on this would imply a broader adoption and better integration in the industry. I am sad that they are asking for a login here though, which doesn't make any sense to me.
KolibriFly 3 hours ago||
That's docker, man. Tomorrow they're gonna add limits on sandbox runs without a premium account too
rvz 2 hours ago||
microVMs (firecracker) have existed for years. This is not new.
pkhamre 3 hours ago||
I started building my own isolated and security-hardened docker image for OpenCode about half a year ago. Been using it daily.

https://github.com/pkhamre/opencode-docker

dejw 32 minutes ago|
if I was paranoid about security I wouldn't use docker in the first place.
espadrine 1 hour ago|
Models start going to extreme, damaging lengths to achieve ambiguous prompts[0]. Having good sandboxes is now a must IMO.

But sbx is a bit annoying to use with OpenCode for instance (which has zero sandboxing by default, unlike codex CLI or Claude Code). You cannot easily change ~/.config/opencode/opencode.jsonc AFAIK.

[0]: Black Hat OpenAI-Hugging Face incident: https://www.youtube.com/watch?v=87DyyMV0kCY&t=1021s

eli 1 hour ago|
That incident was with a model that had the guardrails disabled.

Still obviously you should run all untrusted code in a sandbox, but extreme actions like that would be very unusual with the model that shipped.

More comments...