I am using docker toolbox on Windows 7 to run docker. (docker version 1.9.1)
As it turns out, the docker machine creates its VM at C:\\Users\\username\\.docker\\mach
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
Since 2015, there is now (June 2017) Hyper-V, which allows you to define where you want your VHDX files:
See Docker for Windows 1.13.0, 2017-01-19 (stable):
VHDX file containing images and non-host mounted volumes can be moved (using “advanced” tab in the UI)
That will modify the %APPDATA%\Docker\settings.json
with a line:
"MobyVhdPathOverride":"C:\\Users\\Public\\Documents\\Hyper-V\\New folder\\MobyLinuxVM.vhdx"
See this thread for more.
Original answer
Currently 2015 , docker-machine forces the use of %USERPROFILE%
:
See libmachine/mcnutils/utils.go#L17-L25
As commented in issue 499:
In the meantime, how will users be able to specify where the
.docker/machine/*
files are stored?you can by specifying
--storage-path
on the command line or using the environment variableMACHINE_STORAGE_PATH
.
(You can see it implemented in PR 1941)
Joost Den Boer points out in the comments
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.
I have had a bit of trouble with any of the solutions above but this is what worked for me:
MACHINE_STORAGE_PATH
environment variable to point to your desired
directory/folder..docker
directory..docker
folder from the Users directory.start.sh
script and added the line at the top:e.g.
export MACHINE_STORAGE_PATH=D:\\Docker
This is what worked perfectly for me on Windows 7:
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 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.
{ "graph": "e:\\images" }
This Worked like a charm
Reference - https://forums.docker.com/t/where-are-images-stored/9794/11