关于Docker Toolbox安装的docker更换存储位置,全网都没有多少资料,过程中参考了下面这篇博文,感谢
Docker Toolbox替换默认docker machine的存储位置
https://www.cnblogs.com/ginponson/p/8601320.html
先说一下我的情况,系统是windows server 2012 R2,C盘不够用,所以需要更换默认存储位置,我安装的toolbox版本是19.03.1
方法一:
操作步骤:
- 在开始安装之前就配置环境变量(如果已经安装了,需要卸载,按照上面那篇博文操作,我没有成功)
以我的为例:
添加变量名:MACHINE_STORAGE_PATH
值为F:\Docker\machines
建议:
这里可以先去github下载一下boot2docker.iso,这个需要下载最新版本
下载好后新建个cache目录,路径为:F:\Docker\cache,然后把boot2docker.iso放进去
-
然后再运行DockerToolbox-19.03.1.exe进行安装
这里直接next就行,都是选择默认配置,无需额外操作 -
安装完后,进入目录F:\Docker\machines\machines\default,编辑config.json,配置国内镜像(从这里也可以看出,存储位置在F盘,如果切换不成功,配置项的路径都是在C盘)
{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "192.168.99.100",
"MachineName": "default",
"SSHUser": "docker",
"SSHPort": 54403,
"SSHKeyPath": "F:\\Docker\\machines\\machines\\default\\id_rsa",
"StorePath": "F:\\Docker\\machines",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": "",
"VBoxManager": {},
"HostInterfaces": {},
"CPU": 1,
"Memory": 1024,
"DiskSize": 20000,
"NatNicType": "82540EM",
"Boot2DockerURL": "",
"Boot2DockerImportVM": "",
"HostDNSResolver": false,
"HostOnlyCIDR": "192.168.99.1/24",
"HostOnlyNicType": "82540EM",
"HostOnlyPromiscMode": "deny",
"UIType": "headless",
"HostOnlyNoDHCP": false,
"NoShare": false,
"DNSProxy": true,
"NoVTXCheck": false,
"ShareFolder": ""
},
"DriverName": "virtualbox",
"HostOptions": {
"Driver": "",
"Memory": 0,
"Disk": 0,
"EngineOptions": {
"ArbitraryFlags": [],
"Dns": null,
"GraphDir": "",
"Env": [],
"Ipv6": false,
"InsecureRegistry": [],
"Labels": [],
"LogLevel": "",
"StorageDriver": "",
"SelinuxEnabled": false,
"TlsVerify": true,
"RegistryMirror": ["https://xxx.mirror.aliyuncs.com"],#这里更换阿里镜像
"InstallURL": "https://get.docker.com"
},
"SwarmOptions": {
"IsSwarm": false,
"Address": "",
"Discovery": "",
"Agent": false,
"Master": false,
"Host": "tcp://0.0.0.0:3376",
"Image": "swarm:latest",
"Strategy": "spread",
"Heartbeat": 0,
"Overcommit": 0,
"ArbitraryFlags": [],
"ArbitraryJoinFlags": [],
"Env": null,
"IsExperimental": false
},
"AuthOptions": {
"CertDir": "F:\\Docker\\machines\\certs",
"CaCertPath": "F:\\Docker\\machines\\certs\\ca.pem",
"CaPrivateKeyPath": "F:\\Docker\\machines\\certs\\ca-key.pem",
"CaCertRemotePath": "",
"ServerCertPath": "F:\\Docker\\machines\\machines\\default\\server.pem",
"ServerKeyPath": "F:\\Docker\\machines\\machines\\default\\server-key.pem",
"ClientKeyPath": "F:\\Docker\\machines\\certs\\key.pem",
"ServerCertRemotePath": "",
"ServerKeyRemotePath": "",
"ClientCertPath": "F:\\Docker\\machines\\certs\\cert.pem",
"ServerCertSANs": [],
"StorePath": "F:\\Docker\\machines\\machines\\default"
}
},
"Name": "default"
}
- 然后就可以正常运行Docker Quickstart Terminal了
方法二:
这个方法也是参考了其他人的做法,我是用来更改toolbox的CPU和内存,应该也可以用来更改镜像存储
下面我说一下更改cpu和内存
如图所示,直接打开虚拟机,然后在系统面板进行更改,更改完成后需要重启电脑才能生效。
更改镜像存储:
在存储面板有关boot2docker.iso和disk.vmdk的配置,具体设置我没有尝试,在这里应该也可以更换存储位置
版权声明:本文为weixin_44219085原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。