Change Docker machine location - Windows

后端 未结 12 1327
执笔经年
执笔经年 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:20

    This answer is for people using Docker Toolbox (Windows 10 Home Build 1909, You can follow below steps for docker installation and then location change. I am not adding any images)

    Install Docker Toolkit and VM must be installed with Admin Privileges after the installation of docker toolkit (*because Docker Toolkit also installs VM but it's of lower version and creates a problem with other iso files, u can uncheck also, in that case, *). Now we have to change the location of disk.vmdk and update the new location in VM.

    • Install Docker Toolbox from here. Follow the instructions provided
    • Now Download Virtual Machine v6+
    • Install Virtual Machine as Administrator (By Right-clicking and selecting there)
    • Goto place where your VirtualBox.exe(Not the installer) is present and right-click on it (you can find from the shortcut created on your Desktop)
    • goto properties --> compatibility --> change setting for all users --> select run this program as administrator
    • Now close the VM if it's running and run the Kitematic, If it fails (it will probably) then select option provided related to VM (only 2 options are there)
    • This time it will work, now close it

    Changing the Location where Images will be downloaded

    • open your VM and close a newly running image default (right-click -> close --> power off)
    • copy paste your disk.vmdk file (for me it's present at C:\Users\Dell\.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
    • Now we need to tell the VM also about this change
    • Right-click default image and goto settings
    • Select Storage
    • remove disk.vmdk attachment by right-clicking --> remove (that was the older path binded disk.vmdk)
    • click on file --> virtual media manager and remove disk.vmdk from here also (Now VM don't know if such a disk.vmdk thing exsists)
    • Right-click default image --> storage --> add hard disk (this option is just above that iso image)
    • Now select that disk.vmdk that you have pasted somewhere
    • Now run your docker cli and then run this command docker run hello-world
    • If no error is there then it's all done
    • You can verify size by checking the sizes of those two vmdk disks and then pulling some new images



    I have written a very descriptive answer starting from installation because I did face some issues and so wanted to make it highly straight forward for the others.
    You can delete your disk.vmdk disk (older one) from your C drive if you want to

提交回复
热议问题