Search code examples
dockerboot2docker

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?


Solution

  • 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.