Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase docker-machine memory Mac

People also ask

How do I increase my Docker memory limit?

Set Maximum Memory Access To limit the maximum amount of memory usage for a container, add the --memory option to the docker run command. Alternatively, you can use the shortcut -m . Within the command, specify how much memory you want to dedicate to that specific container.

How do I increase Docker on my Mac?

Ensure that you are using Docker Desktop version 4.6, available here. Navigate to 'Preferences' (the gear icon) > 'Experimental Features' Select the 'Use the new Virtualization framework' and 'Enable VirtioFS accelerated directory sharing' toggles. Click 'Apply & Restart'

Does Docker have a memory limit?

The maximum amount of memory the container can use. If you set this option, the minimum allowed value is 6m (6 megabytes). That is, you must set the value to at least 6 megabytes.

How much RAM is required for Docker?

Minimum: 8 GB; Recommended: 16 GB.


You can do this via the command line. For example, to change the machine from the default 1cpu/2048MB RAM run:

docker-machine stop
VBoxManage modifyvm default --cpus 2
VBoxManage modifyvm default --memory 4096
docker-machine start

You can then check your settings:

VBoxManage showvminfo default | grep Memory
VBoxManage showvminfo default | grep CPU

And for docker-machine inspect to report the correct state of things, edit ~/.docker/machine/machines/default/config.json to reflect your changes.


when you create docker machine, you can nominate the memory size:

docker-machine create -d virtualbox --virtualbox-memory 4096 default

Let me know if this helps.


For Docker version 1.12.1 (build: 12133) and higher on macOS there is an option to change CPU's and RAM from UI and restart docker. You can find the preferences from toolbar. Attaching images for clarity.

Update Aug 2020: Preferences -> Resources (thank you to @swedge218)

Old Step (probably defunct now): Preferences -> Advanced -> adjust resources -> Apply & Restart

https://www.dropbox.com/s/znltd1v4r00nfpu/Screenshot%202017-03-24%2012.12.58.png?dl=0

docker advanced tab (memory)


Docker Machine maintainer here. I don't think adjusting the config.json manually will work.

Your two options are to either create the machine with --virtualbox-memory set, or to adjust the VM's memory in the VirtualBox GUI ("Settings > System" for that VM I think). Make sure the machine is powered off and there should be a little slider that works.

EDIT: Another answer shows that you can do the in-place operation from the command line as well using VBoxManage.


I couldn't get the other answers to work. The only thing that worked for me was to remove the default machine and re-create it with more memory.

docker-machine rm default
docker-machine create -d virtualbox --virtualbox-memory=4096 --virtualbox-cpu-count=2 --virtualbox-disk-size=50000 default

This fix was found here: https://www.ibm.com/developerworks/community/blogs/jfp/entry/Using_Docker_Machine_On_Windows?lang=en


Other answers showed how to change the memory using VBoxManage:

docker-machine stop default
VBoxManage modifyvm default --memory 4096
docker-machine start default

To confirm the change from the command line:

VBoxManage showvminfo default | grep Memory

OR

docker-machine ssh default free