Why are the docs suggesting --ulimit memlock=-1:-1 for running docker image?
#26702
-
|
As far as I understand this tells the docker runtime to not limit the memory consumption of the container, right? I tried to find any related issue, pull request or discussion, but couldn't find anything. Why is this recommended in the docs and what would be the impact of not setting this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Why --ulimit memlock=-1:-1 for Bun DockerThis flag is about memory locking (mlock), not total memory consumption. What it does
Why Bun needs itBun uses memory-mapped files and locked memory for:
Impact of NOT setting itWithout this flag, you may see:
For KubernetesYou can set resource limits separately: resources:
limits:
memory: "512Mi" # Total memory limit still worksThe Alternative: Set a specific limitdocker run --ulimit memlock=67108864:67108864 bun-app
# 64MB locked memory limitThis is safer than unlimited if you have many containers. |
Beta Was this translation helpful? Give feedback.
Why --ulimit memlock=-1:-1 for Bun Docker
This flag is about memory locking (mlock), not total memory consumption.
What it does
memlock= max locked-in-memory address space-1:-1= unlimited soft and hard limitsWhy Bun needs it
Bun uses memory-mapped files and locked memory for:
Impact of NOT setting it
Without this flag, you may see:
failed to lock memoryFor Kubernetes
You can set resour…