Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change boot2docker memory assignment

I've been playing around with docker on a mac so I need to install boot2docker to make it work.

I have a pretty powerful machine and a very resource hungry app so I want to up the available memory from the default which is 1GB to something like 8GB.


This is what I've tried

Booting boot2dock with the --memory param

boot2docker --memory=8116 boot

Change the config file

Verbose = true
VBM = "VBoxManage"
SSH = "ssh"
SSHGen = "ssh-keygen"
SSHKey = "/Users/mjsilva/.ssh/id_boot2docker"
VM = "boot2docker-vm"
Dir = "/Users/mjsilva/.boot2docker"
ISO = "/Users/mjsilva/.boot2docker/boot2docker.iso"
VMDK = ""
DiskSize = 20000
Memory = 8116
SSHPort = 2022
DockerPort = 2375
HostIP = "192.168.59.3"
DHCPIP = "192.168.59.99"
NetMask = [255, 255, 255, 0]
LowerIP = "192.168.59.103"
UpperIP = "192.168.59.254"
DHCPEnabled = true
Serial = false
SerialFile = "/Users/mjsilva/.boot2docker/boot2docker-vm.sock"

and then booting boot2docker

boot2docker boot

None of this approaches seem to work. I only end up only having the default memory.


The only way I manage to change was going to virtualbox GUI shutdown boot2docker, change it manually and boot it again.

Am I missing something?

like image 770
mjsilva Avatar asked Jun 26 '14 03:06

mjsilva


4 Answers

As boot2docker init -m did not work in my version of boot2docker, I just used VBoxManage command:

VBoxManage modifyvm boot2docker-vm --memory 3500

Also, using this I believe you can avoid destroying your VM, you should just stop it and then start again.

like image 131
Aleksei Petrenko Avatar answered Oct 14 '22 07:10

Aleksei Petrenko


It is NOT necessary to delete your boot2docker vm as Abel Muiño said.

Its enough what to do what Alex Petrenko proposed.

  1. boot2docker stop
  2. VBoxManage modifyvm boot2docker-vm --memory 3500
  3. boot2docker start
like image 22
quexer69 Avatar answered Oct 14 '22 08:10

quexer69


You will need to re-initialize the boot2docker VM with the new memory settings:

$ boot2docker delete
$ boot2docker init -m 5555
... lots of output ...
$ boot2docker info
{ ... "Memory":5555 ...}

You can now boot2docker up and the image will always use the configured amount of memory.

like image 23
Abel Muiño Avatar answered Oct 14 '22 07:10

Abel Muiño


You can just tweak the settings in the GUI as well.

  1. Open VirtualBox
  2. Select 'boot2docker-vm'
  3. Click settings
  4. Select system
  5. Tweak your RAM

No need to delete your boot2docker vm.

like image 3
Oliver Shaw Avatar answered Oct 14 '22 08:10

Oliver Shaw