Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
212 views
in Technique[技术] by (71.8m points)

Change Docker machine location - Windows

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:Usersusername.dockermachinemachinesdefault. As I commit the images, the size of VM at this location bloats up. Since it's Windows, I can't afford the luxury of space on the C drive.

Is there any way I can change the location of the default machine?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is what worked perfectly for me on Windows 7:

  1. Setup the MACHINE_STORAGE_PATH environment variable as the root of the location you want to use for the Docker machines/VMs, cache, etc.
  2. Install Docker Toolbox
  3. 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...