OSX上的docker-machine虚拟机映像位置

时间:2021-04-12 02:10:56

I am using docker-machine on OSX (Mac Book) and it places the images in ~/.docker/machine. My drive is almost full and I want to move the images to a different drive. It would be nice if there was an installation option or way to specify a different location for .docker and the sub directories.

我正在OSX (Mac Book)上使用docker-machine,它将图像放在~/.docker/machine上。我的驱动器几乎是满的,我想把图像移动到另一个驱动器。如果有一个安装选项或方法为.docker和子目录指定不同的位置,那就更好了。

Does anyone no of an easy way to do this?

有没有人有什么简单的方法可以做到这一点?

1 个解决方案

#1


1  

This is possible using the MACHINE_STORAGE_PATH environment variable or by specifying one of -s, --storage-path:

这可能使用MACHINE_STORAGE_PATH环境变量,或者指定一个-s, -存储路径:

$ export MACHINE_STORAGE_PATH=/Volumes/Drobo/machine
$ mkdir $MACHINE_STORAGE_PATH
$ docker-machine create test -d virtualbox
Creating CA: /Volumes/Drobo/machine/certs/ca.pem
Creating client certificate: /Volumes/Drobo/machine/certs/cert.pem
Image cache does not exist, creating it at /Volumes/Drobo/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.8.1/boot2docker.iso to /Volumes/Drobo/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env test
$
$ ls -l /Volumes/Drobo/machine/machines/
total 0
drwx------  13 brianz  staff  442 Aug 28 16:37 test

#1


1  

This is possible using the MACHINE_STORAGE_PATH environment variable or by specifying one of -s, --storage-path:

这可能使用MACHINE_STORAGE_PATH环境变量,或者指定一个-s, -存储路径:

$ export MACHINE_STORAGE_PATH=/Volumes/Drobo/machine
$ mkdir $MACHINE_STORAGE_PATH
$ docker-machine create test -d virtualbox
Creating CA: /Volumes/Drobo/machine/certs/ca.pem
Creating client certificate: /Volumes/Drobo/machine/certs/cert.pem
Image cache does not exist, creating it at /Volumes/Drobo/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.8.1/boot2docker.iso to /Volumes/Drobo/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env test
$
$ ls -l /Volumes/Drobo/machine/machines/
total 0
drwx------  13 brianz  staff  442 Aug 28 16:37 test