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\machine\machines\default. And as I commit the images the size of VM at this location bloats up. Since its Windows, cant afford the luxury of space on the C drive.
Is there any way I can change the location of the default machine?
These answers are out of date, as of the latest release. The location is configurable in the Settings user interface.
https://github.com/docker/for-win/issues/333
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.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):
That will modify the
%APPDATA%\Docker\settings.json
with a line: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:
(You can see it implemented in PR 1941)
Joost Den Boer points out in the comments
You can move
.docker
directory to another drive and create a junction point to it.Please note that regular shortcut will not work.
For example:
Move
.docker
directory fromC:\Users\username
toD:\
and run:
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:
Put these two commands when running docker quick start terminal.
I suppose that your new location is "D:\docker" and your new machine name is "docker1"
This should create a new machine with specified name in your new location.