Managed local stack: CPU and memory limits per service, kept across stop and start
Existing issues
- [x] I have searched the existing issues.
Affected area
Docker
Problem to solve
We reproduce a hosted instance's CPU and memory size locally for load testing. The managed local stack has no way to set those limits, and a limit applied by hand is lost when the CLI recreates the container.
Observed on Supabase CLI 3.1.0, Linux, Docker 29.9.2:
docker update --memory 768m --memory-swap 768m <database container>set the container'sHostConfig.Memoryto 805306368 bytes.supabase --experimental stack stop --stack-id <stack id>removed the database container.supabase start --stack-id <stack id> -x rest,auth,realtime,storage,functions,studio,mail,analytics,pooler --runtime dockercreated a new database container, with a new container ID and creation time. ItsHostConfig.Memorywas 0.- The database data and the migration history survived the relaunch.
So a limit set with docker update does not persist across stack stop and stack start, because the CLI recreates the container each time. The CLI 3.1.0 has no setting for container CPU or memory; a search of its sources for container resource options found none.
Proposed solution
Per-service memory and cpus keys in the managed stack's config, passed to the container when the CLI creates it, as the runtime's --memory and --cpus options. Unset keys keep the current behaviour, which is no limit.
Alternatives considered
Raising the Docker Desktop memory limit for the whole VM. This applies to every container, not one stack, and it does not set CPU.
Additional context
The CLI's out-of-memory guidance points to Docker Desktop's global memory setting (apps/cli/src/command-internal/docker-suggest.ts, lines 12–13), which is the only remedy it gives.