Regardless of the mem_limit setting, if you have docker desktop installed, there is a limit in the Settings -> Resources -> Advanced screen which will additionally limit the size of any container:
mem_limit