Move boot2docker and .docker folder in other drive

被刻印的时光 ゝ 提交于 2019-11-30 04:47:22
Larry Cai

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

Oleksandr Horobets
  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.

You can store the images outside of the VirtualBox images. You don't have to move the disk. I like this idea, because the disk by VirtualBox is limited, but if you host in the host, in have the same storage that the host have.

Do it by using VirtualBox shared folder option. I was able to use a folder in C:\ drive, for all the data that docker needs.

To do so you have to mount /var/lib/docker to a local folder in your host machine. Set "Auto-Mount", but do not set "Read-Only".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!