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:
- Stop the
boot2docker VM, and find the place disk.vmdk under
Setting->Storage
- Copy the
disk.vmdk to Disk D (any place)
- Detach (-) the
disk.vmdk in VirtualBox Manager
- Attach (+) the new
disk.vmdk from Disk D. make sure the SATA port number is the same
- Verify the boot2docker env, if not, try to find the reason
- 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