plzhalpplzxubtunu
plzhalpplzxubtunu

Reputation: 53

Limiting Docker RAM use?

I don't care how much memory on-disk my container uses, or how many swaps, but would like to limit its access to RAM.

How do I do that, once I've created the image?

Upvotes: 0

Views: 78

Answers (1)

Arash Motamedi
Arash Motamedi

Reputation: 10682

You can run your container with the -m (aka --memory) switch and specify the maximum amount of RAM you'd like to be available to your running container.

-m or --memory= The maximum amount of memory the container can use. If you set this option, the minimum allowed value is 4m (4 megabyte).

Reference: https://docs.docker.com/config/containers/resource_constraints/#memory

And here: https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources

Upvotes: 1

Related Questions