TransWikia.com

Does a docker container dynamically allocate memory whilst running?

Server Fault Asked on January 16, 2021

With a Docker container, I am trying to find out potential memory use. I can see that I can set memory limits with various settings like --memory --memory-swap etc at https://docs.docker.com/config/containers/resource_constraints/, but I am struggling to find information on it’s variations during use.

If I start a container with --memory=4G I assume, that will limit it to a maximum of 4G (with certain caveats).

However, if it only uses 100M at first, and then needs an extra 2G, and then doesn’t need it any more, is that 2G then freed up for the host system use (so only 100M of host memory is used)? Or does Docker somehow preallocate a chunk of memory that isn’t available to the host OS ?

If there are any docs on this, it would be great to read them.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP