Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks for sharing!

I'm the creator of microsandbox. If there is anything you need to know about the project, let me know.

This project is meant to make creating microvms from your machine as easy as using Docker containers.

Ask me anything.



I'm trying this out now and it's very promising. One problem I'm running into with the Python library is that I'd like to keep that sandbox running for several minutes while I do things like set variables in one call and then use them for stuff several calls later. I keep seeing this error intermittently:

    Error: Sandbox is not started. Call start() first
Is there a suggested way of keeping a sandbox around for longer?

The documented code pattern is this:

    async def main():
        async with PythonSandbox.create(name="my-sandbox") as sb:
            exec = await sb.run("print('Hello, World!')")
            print(await exec.output())
Due to the way my code works I want to instantiate the sandbox once for a specific class and then have multiple calls to it by class methods, which isn't a clean fit for that "async with" pattern.

Any recommendations?


Right. You can skip the `with` context manager and call start and stop yourself.

There is an example of that here:

https://github.com/microsandbox/microsandbox/blob/0c13fc27ab...


async with is just syntactic sugar. You could very well call __aenter__ and __aexit__ manually. You could also use an AsyncExitStack, call __aenter__ manually, then enter_async_context, and call aclose when you’re done. Since aclose method exists I guess this is not an anti-pattern.

https://docs.python.org/3/library/contextlib.html#contextlib...


Looks great! This might be extremely useful for a distributed/decentralized software testing network I'm building (called Valet Network)...

Question: How does networking work? Can I restrict/limit microvms so that they can only access public IP addresses? (or in other words... making sure the microvms can't access any local network IP addresses)



thanks! have an example on how to use that in a sandboxfile?

(also, this project is really cool. great work!)


Yeah. I need to fix that in the docs!


no prob!


Only did a quick skim of the readme, but a few questions which I would like some elaboration.

How is it so fast? Is it making any trade offs vs a traditional VM? Is there potential the VM isolation is compromised?

Can I run a GUI inside of it?

Do you think of this as a new Vagrant?

How do I get data in/out?


> How is it so fast? Is it making any trade offs vs a traditional VM? Is there potential the VM isolation is compromised?

It is a lighweight VM and uses the same technology as Firecracker

> Can I run a GUI inside of it?

It is planned but not yet implemented. But it is absolutely possible.

> Do you think of this as a new Vagrant?

I would consider Docker for VMs instead. In a similar way, it focuses on dev ops type use case like deplying apps, etc.

> How do I get data in/out?

There is an SDK and server that help does that and file streaming is planned. But right now, you can execute commands in the VM and get the result back via the server


> I would consider Docker for VMs instead.

Native Containers would probably solve here, too.

From https://news.ycombinator.com/item?id=43553198 :

>>> ostree native containers are bootable host images that can also be built and signed with a SLSA provenance attestation; https://coreos.github.io/rpm-ostree/container/

And also from that thread:

> How should a microkernel run (WASI) WASM runtimes?

What is the most minimal microvm for WASM / WASI, and what are the advantages to running WASM workloads with firecracker or microsandbox?


> What is the most minimal microvm for WASM / WASI,

By setting up an image with wasmtime for example.

> and what are the advantages to running WASM workloads with firecracker or microsandbox?

I can think of stronger isolation or when you have legacy stuff you need to run alongside.


From https://e2b.dev/blog/firecracker-vs-qemu

> AWS built [Firecracker (which is built on KVM)] to power Lambda and Fargate [2], where they need to quickly spin up isolated environments for running customer code. Companies like E2B use Firecracker to run AI generated code securily in the cloud, while Fly.io uses it to run lightweight container-like VMs at the edge [4, 5].

"We replaced Firecracker with QEMU" (2023) https://news.ycombinator.com/item?id=36666782

"Firecracker's Kernel Support Policy" describes compatible kernel configurations; https://github.com/firecracker-microvm/firecracker/blob/main...

/? wasi microvm kernel [github] https://www.google.com/search?q=wasi+microvm+kernel+GitHub :

- "Mewz: Lightweight Execution Environment for WebAssembly with High Isolation and Portability using Unikernels" (2024) https://arxiv.org/abs/2411.01129 similar: https://scholar.google.com/scholar?q=related:b3657VNcyJ0J:sc...


i'm on a mid-level laptop, at times with slow or expensive internet, running ubuntu. i want to be able to run nominally-isolated "copies" of my laptop at near-native speed

1. each one should have it's own network config, eg so i can use wireguard or a vpn

2. gui pass-through to the host, eg wayland, for trusted tools, eg firefox, zoom or citrix

3. needs to be lightweight. eg gnome-boxes is dead simple to setup and run and it works, but the resource usage was noticeably higher than native

4. optional - more security is better (ie, i might run semi-untrusted software in one of them, eg from a github repo or npm), but i'm not expecting miracles and accept that escape is possible

5. optional - sharing disk with the host via COW would be nice, so i'd only need to install the env-specific packages, not the full OS

i'm currently working on a podman solution, and i believe that it will work (but rebuilding seems to hammer the network - i'm hoping i can tweak the layers to reduce this). does microsandbox offer any advantages for this use case ?


> 1. each one should have it's own network config, eg so i can use wireguard or a vpn

This is possible right now but the networking is not where I want it to be yet. It uses libkrun's default TSI impl; performant and simplifies setup but can be inflexible. I plan to implement an alternative user-space networking stack soon.

> 2. gui pass-through to the host, eg wayland, for trusted tools, eg firefox, zoom or citrix

We don't have GUI passthrough. VNC?

> 3. needs to be lightweight. eg gnome-boxes is dead simple to setup and run and it works, but the resource usage was noticeably higher than native

It is lightweight in the sense that it is not a full vm

> 4. optional - more security is better (ie, i might run semi-untrusted software in one of them, eg from a github repo or npm), but i'm not expecting miracles and accept that escape is possible

The security guarantees are similar to what typical VMs support. It is hardware-virtualized so I would say you should be fine.

> 5. optional - sharing disk with the host via COW would be nice, so i'd only need to install the env-specific packages, not the full OS

Yeah. It uses virtio-fs and has overlayfs on top of that for COW.


Looks neat. If I understand correctly, I can use it to spin up backends on the fly? You have an ambitious list of languages to support: https://github.com/microsandbox/microsandbox/tree/main/sdk

edit: A fleshed out contributors guide to add support for a new language would help. https://github.com/microsandbox/microsandbox/blob/main/CONTR...


Yes. Self-hosting and using it on your own backend infra is the main use-case. And JVM support should just work since it is a Linux machine.


Hi appcypher, very cool project! Does the underlying MicroVM feature provide an OCI runtime interface, so that it could be used as a replacement for runc/crun in Docker/Podman?


No. Not yet. Would be nice to have


Thanks for your response!

One more question: What syscalls do I need to have access to in order to run a MicroVM? I'm asking because ideally I'd like to run container workloads inside existing containers (self-hosted GitLab CI runners) whose configuration (including AppArmor) I don't control.


How does the microvm architecture compare with firecracker?


They are similar. We use libkrun under the hood. Firecracker team seems not to be interested in a macOS implementation


Ah gotcha! I was unaware that firecracker used KVM under the hood.


Can you explain how this compares to Kata Containers? [0] That also supports OCI to run microVMs. You can also choose different hypervisors such as firecracker to run it on.

[0] https://katacontainers.io/


Katacontainers is an interesting project. Microsandbox is a more opinionated project with a UX that focuses on getting up and running with microVMs quickly. I want this experience for Linux, macOS and Windows users.

More importantly is making sandboxing really accessible to AI devs with `msb server`.


Cool project. Off topic question: Are the images in the "Use Cases" section in the README from a real app? I like the clean UI design.


No they are not.


Can you use Microsandbox for everything you can use Docker for, or are there cases where containers make more sense?

Congratulations on the launch!


We want microsandbox to be usable for everything you can with Docker.

That said, hosting microVMs require dedicated hardware or VMs with nested virt support. Containers don’t have that problem.


This is very neat tech, but I think you might want to wait until you actually have Windows covered before making claims like https://github.com/microsandbox/microsandbox/blob/main/MSB_V...


What do you mean?


Think I can build a notebook on top of this ? Jupyter client has been a pain to manage


Not sure what that entails. You can try and I can help along the way


Are you ready for the deluge of networking questions for all the buck wild configurations?


Lol. I should brace for impact.

Networking continues to be a pain but I'm open to suggestions.


What's the story for macOS support?


It uses libkrun which uses Hypervisor.framework on macOS.


I like the idea. But when you say "bullet proof" security, there are exploits to break out of VMs that exist. Have you looked into those?


Will fix the docs




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: