Resource limits
Cap what one app or database may take from its server, memory, CPU, processes, files, disk.
What it is
Without them, one runaway container can take a host down, and everything else with it.
Settings -> Resources, on an app or a database.
How it works
Each field becomes a key in the rendered Compose file, applied by Docker when the container starts. They are enforced by the kernel, not by Deplo, which is why they take effect on the next deploy and not before.
Every dimension is independently optional. Setting a memory limit does not oblige you to set anything else.
The two that matter
Prop
Type
Quick size presets both together for the common cases, and is what most people should use. Clear all removes every limit.
A memory limit is a kill switch, not a throttle. A process that goes past it is terminated, not slowed down. Set it above the app's real peak, not at it, and watch Monitoring for a while before tightening.
Advanced limits
Prop
Type
Limits and gotchas
- Disk quota only works on some hosts. It needs
overlay2on XFS with project quotas, or devicemapper. Anywhere else, Compose rejects the key and the deploy fails. Leave it alone unless you know the storage driver. - MySQL and MariaDB will not start under about 512 MB. The interface warns you about exactly this on a database.
- Limits apply on the next deploy. Save, then redeploy.
- A container killed for memory looks like a crash. The logs end mid-work with no error, and the app restarts. If a container dies at the same size every time, this is why.
- CPU limit and CPU shares are different things. A limit is a ceiling that applies always. Shares only matter when the machine is contended.
If it does not work
- The container is killed repeatedly - the memory limit is under its real peak. Raise it, or fix the leak.
- The deploy fails on the storage option - the host does not support disk quotas. Clear that field.
- The limits seem to do nothing - they were saved but not deployed. Redeploy.
More in Deploys and builds troubleshooting.
See also
Did this page help you?