Skip to content

Feature Request: Add CPU and Memory Limits to podman exec #26875

@cetr1n

Description

@cetr1n

Feature request description

First of all, thank you for the amazing work on Podman — it's been a game-changer for container management without needing a daemon.

I’d like to propose a feature enhancement for podman exec: the ability to set CPU and memory limits for processes executed via exec.

In some scenarios, especially in production environments, we need to run ad-hoc commands inside containers (e.g., database queries, diagnostics, or batch jobs) using podman exec. However, these processes can consume excessive resources and impact the container’s overall performance.
Currently, resource limits (like --cpus or --memory) can only be set at container creation. It would be extremely useful to apply temporary resource constraints to individual processes launched via podman exec.

Suggest potential solution

Introduce optional flags to podman exec, such as:

podman exec --cpus=0.5 --memory=256m

These flags would:

  • Create a temporary cgroup for the exec’d process
  • Apply the specified resource limits
  • Clean up after the process exits

This would allow better control over resource usage without needing to spawn a separate container just for one command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.stale-issuetriagedIssue has been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions