Just tried '-s <path>' on a Mac and it seems to work fine. What might not be obvious is that the path option goes before the command.
Running "docker-machine -s /Volumes/other/location' create --driver=virtualbox" created a new VirtualBox image at the other location.
This is what worked perfectly for me on Windows 7:
Setup the MACHINE_STORAGE_PATH environment variable as the root of the location you want to use for the Docker machines/VMs, cache, etc.
Install Docker Toolbox
Run Docker Quickstart Terminal
Docker Toolbox will now create all the files at the location pointed at by MACHINE_STORAGE_PATH.
UPDATE:
Note that creating a new VM with the new storage path is not ideal, as the Docker Quickstart Terminal scripts don't seem to work with anything not named "default".
If you've already got a VM sitting in the C: drive, then the simplest thing to do would be to go to Oracle VirtualBox and delete the "default" VM, uninstall Docker Toolbox, delete C:\Users\<username>.docker\, and then follow the 3 steps above.
Note: uninstalling and reinstalling Docker Toolbox may not be required. But I haven't tested without it.
Update
To move Docker certificates also, set the DOCKER_CERT_PATH variable to point to the path of the new drive. Thanks to @Nutle for the tip.
I could not get the MACHINE_STORAGE_PATH environment variable method working. It kept complaining about missing certificates when first initialising the machine. Still on Windows 7 so have to use docker-toolbox.
I got around the issue by:
Uninstalling Docker Toolbox and restarting machine
Open up Administrator prompt (Find command prompt, hold shift, choose "Run As Administrator")
Deleting .docker from %USERPROFILE%: rmdir /S %USERPROFILE%.docker
Create folder called .docker elsewhere: mkdir a:\.docker
mklink /J %USERPROFILE%.docker a:\.docker
Close Admin command prompt
Reinstall Docker Toolbox
Use the Docker Quickstart Terminal link to bootstrap everything.
Kitematic can be opened now too (though I had to choose the "Use Virtual Box" option on first error.
I found lots of these answers were out of data, at least they did not work in my environment: win10 PRO, docker desktop community 2.0.0.3. Finally, I resolved this problem by this method:
uninstall docker
open Hyper-V manager (press WIN key and then enter "Hyper")
Change the default virtual hard disk locations in the Hyper-V settings (not on the VM settings) and confirm
install docker
check the disk image location in advanced options of docker settings
Create file called c:\programdata\docker\config\daemon.json with content below where e:\images is location where do you want to store all you images etc. restart docker.
I use windows 10 and Docker desktop (community) Version 2.0.0.0, I want to move vhdx file to another Drive.
Right click over Docker Desktop -> Settings
then the Docker Desktop UI will open go to Advance -> Disk image location
just change the path to new destination, the whole process was smooth and fast for me - it's automatically copy the vhdx file from original path to new path restart docker and all work as expected
This answer is for people using Docker Toolbox (Windows 10 Home Build 1909, You can follow below steps for docker installation and then location change. I am not adding any images)
Install Docker Toolkit and VM must be installed with Admin Privileges after the installation of docker toolkit (*because Docker Toolkit also installs VM but it's of lower version and creates a problem with other iso files, u can uncheck also, in that case, *). Now we have to change the location of disk.vmdk and update the new location in VM.
Install Docker Toolbox from here. Follow the instructions provided
Now Download Virtual Machine v6+
Install Virtual Machine as Administrator (By Right-clicking and selecting there)
Goto place where your VirtualBox.exe(Not the installer) is present and right-click on it (you can find from the shortcut created on your Desktop)
goto properties --> compatibility --> change setting for all users --> select run this program as administrator
Now close the VM if it's running and run the Kitematic, If it fails (it will probably) then select option provided related to VM (only 2 options are there)
This time it will work, now close it
Changing the Location where Images will be downloaded
open your VM and close a newly running image default (right-click -> close --> power off)
copy paste your disk.vmdk file (for me it's present at C:\Users\Dell\.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
Now we need to tell the VM also about this change
Right-click default image and goto settings
Select Storage
remove disk.vmdk attachment by right-clicking --> remove (that was the older path binded disk.vmdk)
click on file --> virtual media manager and remove disk.vmdk from here also (Now VM don't know if such a disk.vmdk thing exsists)
Right-click default image --> storage --> add hard disk (this option is just above that iso image)
Now select that disk.vmdk that you have pasted somewhere
Now run your docker cli and then run this command docker run hello-world
If no error is there then it's all done
You can verify size by checking the sizes of those two vmdk disks and then pulling some new images
I have written a very descriptive answer starting from installation because I did face some issues and so wanted to make it highly straight forward for the others. You can delete your disk.vmdk disk (older one) from your C drive if you want to
copy paste your disk.vmdk file (for me it's present at C:\Users\name.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
in Virtualbox Right-click default image and goto settings
Select Storage remove disk.vmdk attachment by right-clicking --> remove
click on file --> virtual media manager and remove disk.vmdk from here also
Right-click default image --> storage --> add hard disk (this option is just above that iso image)Now select that disk.vmdk that you have pasted somewhere
change now this path in config.json (C:\Users\name.docker\machine\machines\default\config.json)
change the storage path with this new one where u put the location of your hard disk ( "StorePath": "F:\docker-image")