Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a memory limit for an entire docker-compose stack?

Besides setting a limit for each service (container) inside the docker-compose I'd love to know if there is any way to simply limit the memory the docker-compose stack has access to, similarly to the solution of every container but generalized for all the stack.

like image 851
Christian G. Faraone Avatar asked May 28 '26 23:05

Christian G. Faraone


1 Answers

As of today, there's no "global stack" memory limit (or CPU limit) option with Docker Compose (or Compose Specs).

Instead, you can:

  • Limit per containers as you already suggested
  • Limit at Docker daemon level as per @Mihal By comment on question
like image 94
Pierre B. Avatar answered May 31 '26 15:05

Pierre B.