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

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

问题描述

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

I am using docker toolbox on Windows 7 to run docker. (docker version 1.9.1)

事实证明,docker 机器在 C:Usersusername.dockermachinemachinesdefault 处创建了它的 VM.当我提交图像时,此位置的 VM 大小会膨胀.由于是 Windows,我负担不起 C 盘上的奢侈空间.

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?

推荐答案

这对我来说在 Windows 7 上非常有效:

This is what worked perfectly for me on Windows 7:

  1. 将 MACHINE_STORAGE_PATH 环境变量设置为要用于 Docker 机器/VM、缓存等的位置的根目录.
  2. 安装 Docker 工具箱
  3. 运行 Docker 快速入门终端

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

Docker Toolbox will now create all the files at the location pointed at by MACHINE_STORAGE_PATH.

更新:

请注意,使用新存储路径创建新 VM 并不理想,因为 Docker 快速入门终端脚本似乎不适用于任何未命名为默认"的内容.

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".

如果您已经在 C: 驱动器中安装了一个 VM,那么最简单的方法是转到 Oracle VirtualBox 并删除默认"VM,卸载 Docker Toolbox,删除 C:Users<username>.docker,然后按照上面的 3 个步骤操作.

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.

注意:可能不需要卸载和重新安装 Docker Toolbox.但没有它我还没有测试过.

Note: uninstalling and reinstalling Docker Toolbox may not be required. But I haven't tested without it.

更新

还要移动 Docker 证书,请将 DOCKER_CERT_PATH 变量设置为指向新驱动器的路径.感谢@Nutle 的提示.

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天全站免登陆