Tutorials
Services and ports
Start a service inside a microVM and expose only the ports you intend to reach from the host.
Long-running services are useful for preview servers, API sandboxes, browser targets, and test dependencies.
Start a service
Section titled “Start a service”mvmctl machine run --manifest . --name servicebox --port 8080:8000 -- \ python -m http.server 8000The exact command surface may vary by backend and profile; check CLI Commands for current flags.
Security checklist
Section titled “Security checklist”- Bind only the ports you need.
- Prefer loopback host exposure for local development.
- Do not expose admin consoles without auth.
- Review ingress admission and teardown audit events.
- Stop or cold-pause the sandbox when the service no longer needs CPU.
Planned runtime SDK shape
Section titled “Planned runtime SDK shape”Status: Planned lifecycle API.
sandbox = Sandbox.create( image="nix:./flake#service", network={"mode": "none", "ports": [{ "mapping_id": 1, "proto": "tcp", "transform": "opaque", "host_addr": "127.0.0.1", "host": 8080, "guest_addr": "127.0.0.1", "guest": 8000, }]},)proc = sandbox.exec_background(["python", "-m", "http.server", "8000"])const sandbox = await Sandbox.create({ image: "nix:./flake#service", network: { mode: "none", ports: [{ mapping_id: 1, proto: "tcp", transform: "opaque", host_addr: "127.0.0.1", host: 8080, guest_addr: "127.0.0.1", guest: 8000, }] },});const proc = await sandbox.execBackground(["node", "server.js"]);