Setting Resource Limits

By default, Dokku allows unlimited resource access to apps deployed on a server. Dokku provides resource management commands that enable you to limit or reserve specific resources for your apps.

Resource limits will ensure that your app does not go over the specified value. For example, limit my-app to using half of the total CPU:

dokku resource:limit --cpu 0.5 my-app

Limit my-app to using 256 MB of memory:

dokku resource:limit --memory 256 my-app

Limit the my-app worker process to using 256 MB of memory:

dokku resource:limit --memory 256 --process-type worker my-app

Resource reservations will ensure that your server has at least the specified resources before placing a given app's process. However, if there a resource exhaustion, future rebuilds and deploys may fail.

dokku resource:reserve --memory 256 my-app

Dokku resource limits and reservations only apply to runtime containers and one-off process containers. To set limits for the build phase, you will need to use set Docker engine options for your app:

dokku docker-options:add my-app build "--cpus='0.5' -m='512m'"

Please be aware that setting resource limits will affect the performance of your applications if they require more resources than permitted by the limit. 

Dokku Reference

Resource Management