Change Docker machine location - Windows

后端 未结 12 1317
执笔经年
执笔经年 2020-12-02 05:08

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\\mach

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 05:33

    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):

    VHDX file containing images and non-host mounted volumes can be moved (using “advanced” tab in the UI)

    That will modify the %APPDATA%\Docker\settings.json with a line:

    "MobyVhdPathOverride":"C:\\Users\\Public\\Documents\\Hyper-V\\New folder\\MobyLinuxVM.vhdx"
    

    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:

    In the meantime, how will users be able to specify where the .docker/machine/* files are stored?

    you can by specifying --storage-path on the command line or using the environment variable MACHINE_STORAGE_PATH.

    (You can see it implemented in PR 1941)

    Joost Den Boer points out in the comments

    Just tried '-s ' on a Mac and it seems to work fine.
    What might not be obvious is that the path option goes before the command.
    Running "docker-machine -s /Volumes/other/location' create --driver=virtualbox" created a new VirtualBox image at the other location.

提交回复
热议问题