Windows Server2016正式发布已经有一段时间了。无可厚非,原生Docker的支持是这个版本一个很是大的亮点。html
Windows Container 的安装在网上有不少教程,我这里不过多的描述,能够参考:linux
Windows Container 目前支持的镜像必须是 windows内核的image (包括Server Core/Nano Server),一些image还处于测试阶段,坑比较多。github
在最新版本的Docker for windows里,实现了Windows container 和 Liunx的切换,但目前只能在windows10环境里安装(若是有其它方法请告之)。docker
本文就以在windows 2016里安装Docker Registry镜像为例,讲解一下如何在Windows Server2016里的Hyper-v里经过VM安装Dockershell
首先确保Hyper-V功能已开启。不作过多介绍。windows
在Hyper-v管理器界面里,在右边的操做栏里,打开虚拟交换机管理器markdown
新建虚拟网络交换机网络
我这里已经建好后的结果如:测试
重启电脑
Docker-Machine默认是没有安装,须要自行下载
http://github.com/docker/machine/releases
下载后重命名为 docker-machine.exe
docker-machine create -d hyperv --hyperv-virtual-switch "<NameOfVirtualSwitch>" <nameOfNode>
对应我这里就是
` docker-machine create -d hyperv --hyperv-virtual-switch "DockNAT" VM8 `
而后就是等待
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "DcokNAT" VM8 Running pre-create checks... Creating machine... (manager1) Copying C:\Users\Vicky\.docker\machine\cache\boot2docker.iso to C:\Users\Vicky\.docker\machine\machines\manag er1\boot2docker.iso... (manager1) Creating SSH key... (manager1) Creating VM8... (manager1) Using switch "DockNAT" (manager1) Creating VHD (manager1) Starting VM... (manager1) Waiting for host to start... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Checking connection to Docker... Docker is up and running! To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Doc ker\Docker\Resources\bin\docker-machine.exe env VM8 PS C:\WINDOWS\system32>
把当前主机设置为默认docker命令运行的主机,根据提示,咱们运行下面命令
docker-machine.exe env VM8
运行命令: @FOR /f "tokens=*" %i IN ('docker-machine env vm8') DO @%i
完成后,运行命令: docker version
查看主机信息
安装Registry的教程,我这里就不详细说了,能够参照:
http://www.cnblogs.com/lienhua34/p/4922130.html
至此,咱们完成了 linux 版本的docker 在Windows Server 2016中的安装。
我也是初学,摸着石头过河,若有错误,请指正。