Search code examples
dockermemgraphdb

How can I limit the Memgraph memory limit when I use Docker?


I know that I can limit the whole Docker memory usage by changing some WSL2 settings. I've read about that in https://itnext.io/wsl2-tips-limit-cpu-memory-when-using-docker-c022535faf6f and I've seen a question about this already on Stackoverflow (How to limit memory usage when I run Memgraph Platform within Docker?).

I don't want to limit the whole Docker, just one instance of Memgraph Platform.

I've run this command C:\>docker run -it -p 7687:7687 -p 3000:3000 -p 7444:7444 memgraph/memgraph-platform --memory-limit=50

But I got the following error

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "--memory-limit=50": executable file not found in $PATH: unknown.


Solution

  • When you using memgraph-platform image the configuration options are passed with environment variables. The correct syntax is:

    docker run -it -p 7687:7687 -p 3000:3000 -p 7444:7444 -e MEMGRAPH="--memory-limit=50" memgraph/memgraph-platform