The super large disk.vmdk file for the “default” VM created by DTB is usually located at C:\Users\[username]\.docker\machine\machines\default
Now you want to move the existing disk.vmdk file to your much larger D: drive without having to recreate a docker machine/host from scratch and pulling all images on to it again.
Therefore if you need to move the VM disk file to another location you should change VBox configuration for the VM instead of changing any Docker machine configurations (or using any docker commands)
So here are the steps you need to follow.
1. Stop the running docker machine (i.e. VBox VM) like so:
Note: This will effectively power off the VBox VM, named ‘default’. You can check this by opening the VBox GUI.
2. Copy the disk.vmdk file from C:\Users\[username]\.docker\machine\machines\default to a suitable folder in your bigger D: drive. I created D:\docker-machines\default for this.
Now the interesting part 🙂 We need to tell VBox about the new location of the disk.vmdk file.
3. The default.vbox file located at C:\Users\[username]\.docker\machine\machines\default\default specifies the path to the vmdk file. This vbox file is an XML file, so just open it up in any editor and set the Machine/MediaRegistry/HardDisks/HardDisk/location attribute to the new location on your D: drive.
Note: Don’t worry about the “DO NOT EDIT THIS FILE..” statement on top since you have already stopped the VM, the file will not be overwritten. And I found this method easier than using the GUI 🙂
4. Now power up the docker machine using:
If the ‘default’ machine start without any problem then you are good to go!
Now check if all your images are still available using:
5. You can verify that the vmdk file on D: is being used by firing up VBox and selecting the “default” VM and clicking on Settings/Storage/disk.vmdk as shown below.
6. Now you are done! Just go ahead and delete the huge disk.vmdk from your C: drive located at C:\Users\[username]\.docker\machine\machines\default