Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move boot2docker and .docker folder in other drive

Tags:

I'm new in docker. I have installed docker in windows in the D drive but the Boot2docker VM is in the user folder in the C drive.

I dont have enough space in the C and the boot2docker is growing when i pull softwares from the docker hub.

So I want to move the boot2docker or the .docker folder in the D drive.

Is it possible ? and how can i do ?

like image 991
berzeker Avatar asked Oct 28 '15 13:10

berzeker


2 Answers

  1. Stop boot2docker VMs
  2. Copy the file C:\Users\$USERNAME\VirtualBox VMs\boot2docker-vm\boot2docker-vm.vmdk to drive D: (don't delete it just yet).
  3. Open Oracle VM VirtualBox Manager app.
  4. Open File / Virtual Media Manager.
  5. Release and remove boot2docker-vm.vmdk.
  6. Back to main panel. Right click on boot2docker-vm, choose Settings.
  7. Choose Storage.
  8. Add harddisk, then choose boot2docker-vm.vmdk from new location.
like image 37
Oleksandr Horobets Avatar answered Sep 19 '22 03:09

Oleksandr Horobets


Moving existing disk

The big size for the VM machine is .vmdk or .vdi, so you just need to move the disk to Drive D instead of moving whole .docker directory.

What you can do in simple way in Oracle VirtualBox Manager GUI:

  1. Stop the boot2docker VM, and find the place disk.vmdk under Setting->Storage
  2. Copy the disk.vmdk to Disk D (any place)
  3. Detach (-) the disk.vmdk in VirtualBox Manager
  4. Attach (+) the new disk.vmdk from Disk D. make sure the SATA port number is the same
  5. Verify the boot2docker env, if not, try to find the reason
  6. Remove the disk.vmdk in Disk C to save space if migration is finished.

It shall work as I am always lack of disk space and move those disks around

For new created disk

Normal it will create to your use default user directory, but it is possible to redirect to new place by using flag --storage-path during creation

$ docker-machine --storage-path f: create -d virtualbox dev

see related questions in How can I make docker-machine create a VM in a specific location

like image 53
Larry Cai Avatar answered Sep 19 '22 03:09

Larry Cai