How does we change memory dedicated to Docker in Linux?

As part of Docker certification projects, I’m trying to run the confluent cp-demo docker image. I’m using Ubuntu 20-04 and in order to start the container, I need to increase the docker max memory setting from the default 2GB to 8GB.

This can be done easily on Windows and Mac by the Docker Desktop app but that isn’t available on Ubuntu and I haven’t found a way to modify it using the cli. (I can only modify the memory of a container after I started it with the cli,but in order to start cp-demo it says I need to change the memory setting first).

Does anyone know how can I do this?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

You can specify the memory for the container with the docker run command as follows:

docker run -d --name your-container-name --memory 300M ubuntu

Hope that this helps. Regards, Bobby