一、win10以下用户推荐下载Docker Toolbox
1.安装docker Toolbox
安装完成后建议断开本地网络
2.指定docker machine的位置
a.在Windows的系统环境添加MACHINE_STORAGE_PATH ,指向虚拟机的位置(例如F:\vm\docker)
b.复制安装目录下boot2docker.iso到虚拟机的位置同级目录cache中,没有该文件夹自己创建(F:\vm\docker\cache)
3.修改start.sh脚本
找到"${DOCKER_MACHINE}" create
--engine-registry-mirror 指定加速地址
--virtualbox-disk-size 指定虚机空间大小,单位M
调整为
"${DOCKER_MACHINE}" create '--engine-registry-mirror=https://8080ka5p.mirror.aliyuncs.com' -d virtualbox --virtualbox-disk-size "100000" $PROXY_ENV "${VM}"
4.运行Docker QuickStart安装即可
5.镜像加速
docker-machine ssh default
sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=https://registry.docker-cn.com |g" /var/lib/boot2docker/profile
exit
docker-machine restart default
6.建议虚机分配至少2cpu、2G内存,在Oracle VM VirtualBox关闭虚机后调整
7.验证命令
docker ps
docker-machine ssh default
当类似
docker search mysql
该命令无法执行使,需要调整一下dns
sudo vi /etc/resolv.conf
nameserver 8.8.8.8
二、win10
1.对于Windows 10 Home的用户
1.1安装要求
Windows 10 Home machines must meet the following requirements to install Docker Desktop:
Install Windows 10, version 1903 or higher.
Enable the WSL 2 feature on Windows. For detailed instructions, refer to the Microsoft documentation.
The following hardware prerequisites are required to successfully run WSL 2 on Windows 10 Home:
64 bit processor with Second Level Address Translation (SLAT)
4GB system RAM
BIOS-level hardware virtualization support must be enabled in the BIOS settings. For more information, see Virtualization.
Download and install the Linux kernel update package.
1.2客户端安装
https://docs.docker.com/docker-for-windows/install-windows-home/
1.3镜像加速
在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:
{ "registry-mirrors": ["https://registry.docker-cn.com"] }
2.对于Windows 10 专业版以上的用户
2.1安装要求
Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later).
Hyper-V and Containers Windows features must be enabled.
2.2客户端安装
https://docs.docker.com/docker-for-windows/install/
2.3镜像加速
在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:
{ "registry-mirrors": ["https://registry.docker-cn.com"] }
注意:
Docker for Windows 和 Docker Toolbox互不兼容,如果同时安装两者的话,需要使用hyperv的参数启动。
docker-machine create --engine-registry-mirror=https://8080ka5p.mirror.aliyuncs.com -d hyperv default
Docker for Windows 有两种运行模式,一种运行Windows相关容器,一种运行传统的Linux容器。同一时间只能选择一种模式运行。
© 著作权归作者所有
发表评论