apple / apple/container

Feature request: dynamic resource reallocation for running containers

Open
#1,867 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### Problem

Currently, each container VM allocates CPU and memory at startup with fixed limits. There is no way to hot-adjust these limits while a container is running. This makes it difficult to build higher-level orchestration on top of container, because resources cannot be fluidly redistributed across containers based on load.

### Use case

Running multiple containers on a Mac Studio (e.g., LLM inference + database + web server + Home Assistant). When idle containers sit with unused memory while active containers hit OOM, you currently have to manually stop/restart to resize — which defeats the purpose of running them as always-on services.

Even more interesting: a dedicated "orchestrator container" that monitors resource usage across all business containers and dynamically shifts memory/cpu from idle containers to busy ones, similar to a single-node Kubernetes scheduler.

### Proposed solution

- Expose an API (CLI or gRPC) to hot-resize a running container VM: `container resize --memory 16GB --cpu 4`
- Support Linux memory balloon driver in the bundled kernel config, so the guest OS can shrink/expand its memory without rebooting
- Or extend `container machine` to support runtime resource tuning

### Why this matters

The VM-per-container model gives great isolation, but without dynamic resource reallocation, the isolation comes at the cost of rigid resource silos. Adding hot-resize would unlock a class of use cases where container transitions from "dev tool" to "local server platform."

Related: would love to see a `container stats` command showing current memory/cpu usage per container.

Thanks for the great work on v1.0!

Contributor guide

Open the contributing guide

Research direction

No implementation files or tests are named. Start by locating the existing container machine resource-management entry point and the CLI or gRPC surface, then check the bundled kernel configuration for Linux memory balloon support. Done would mean an agreed implementation path for runtime CPU and memory resizing, with a defined interface and validation for running containers.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, linux, swift
Domain
api, cli, devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.