更改Docker机器位置 - Windows [英] Change Docker machine location - Windows

查看:148
本文介绍了更改Docker机器位置 - Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上使用docker工具箱来运行docker。 (docker版本1.9.1)



原来,docker机器会在C:\Users\username\.docker\machine\ machines\default。当我提交图像时,VM的大小在这个位置膨胀。自从Windows以来,C驱动器无法承受空间的奢侈。



有没有办法改变默认机器的位置?

解决方案

这是在Windows 7上对我有用的功能:


  1. 将MACHINE_STORAGE_PATH环境变量设置为您要用于Docker机器/ VM,缓存等的位置的根。

  2. 安装Docker Toolbox

  3. 运行Docker快速入门终端

Docker Toolbox现在将创建所指向的位置的所有文件MACHINE_STORAGE_PATH。



更新:



请注意,使用新的存储路径创建新的虚拟机并不理想,因为Docker Quickstart Terminal脚本似乎不适用于任何未命名的default。



如果您已经有一个虚拟机坐在C:驱动器中,那么最简单的事情是去Oracle VirtualBox并删除默认VM,卸载Docker Toolbox,删除C:\Users\< username> .docker\,然后按照上面的3个步骤。 / p>

注意:un可能不需要安装和重新安装Docker Toolbox。但是我没有测试没有测试。



更新



证书也设置 DOCKER_CERT_PATH 变量指向新驱动器的路径。感谢@Nutle的提示。


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?

解决方案

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.

这篇关于更改Docker机器位置 - Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆