Skip to main content
Services are named, persistent processes running inside a sandbox — think web servers, background workers, databases, or any daemon you want to manage independently.

Create a service

pocketenv service create my-sandbox api "npm start" \
  --description "Node.js API server" \
  --ports 3000 8080
Arguments:
  • <sandbox> — target sandbox name or ID
  • <name> — service name
  • <command...> — command to run
Options:
  • --description, -d — human-readable description
  • --ports, -p — ports the service listens on (space-separated)

SDK

const service = await sandbox.service.add("api", {
  command: "npm start",
  description: "Node.js API server",
  ports: [3000, 8080],
});
console.log(service.id);

List services

pocketenv service list my-sandbox
pocketenv service ls my-sandbox   # alias

SDK

const services = await sandbox.service.list();
// [{ id: "...", name: "api", command: "npm start", ... }]

Lifecycle

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

SDK

await sandbox.service.start(serviceId);
await sandbox.service.stop(serviceId);
await sandbox.service.restart(serviceId);
await sandbox.service.delete(serviceId);

Update a service

# Update via API (see API reference)

SDK

await sandbox.service.update(serviceId, {
  command: "node dist/index.js",
  description: "Updated API server",
  ports: [3000],
});

Example: full workflow

# 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"

API