Memory management - js heap size

I'm running node-red on a docker container, on Linux.
Node.js v 14.18.2
Node-red v 2.2.2

I have several flows. When the all active, or even few of them, i have an error thrown y nodejs.

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memery.

The error occurs when i run node-red UI and when i invoke http endpoints in my flows.
When i use each flow separately i have no errors.

I need to increase js heap size in the docker container.
I use docker compose.

What is the best way to do it?