Create a service
<sandbox>— target sandbox name or ID<name>— service name<command...>— command to run
--description, -d— human-readable description--ports, -p— ports the service listens on (space-separated)
Define and manage long-running processes inside your sandbox.
pocketenv service create my-sandbox api "npm start" \
--description "Node.js API server" \
--ports 3000 8080
<sandbox> — target sandbox name or ID<name> — service name<command...> — command to run--description, -d — human-readable description--ports, -p — ports the service listens on (space-separated)const service = await sandbox.service.add("api", {
command: "npm start",
description: "Node.js API server",
ports: [3000, 8080],
});
console.log(service.id);
pocketenv service list my-sandbox
pocketenv service ls my-sandbox # alias
const services = await sandbox.service.list();
// [{ id: "...", name: "api", command: "npm start", ... }]
pocketenv service start <service-id> # Start a stopped service
pocketenv service stop <service-id> # Stop a running service
pocketenv service restart <service-id> # Restart
pocketenv service delete <service-id> # Remove permanently
await sandbox.service.start(serviceId);
await sandbox.service.stop(serviceId);
await sandbox.service.restart(serviceId);
await sandbox.service.delete(serviceId);
# Update via API (see API reference)
await sandbox.service.update(serviceId, {
command: "node dist/index.js",
description: "Updated API server",
ports: [3000],
});
# Create sandbox and a web service
pocketenv create web-app --base openclaw
pocketenv env put web-app PORT 3000
pocketenv service create web-app server "node app.js" --ports 3000
# Start everything
pocketenv start web-app
pocketenv service start <service-id>
pocketenv expose web-app 3000 "App"
Was this page helpful?