如何在安装Docker的同时在Windows Server 2016 TP4中正确创build虚拟交换机? (不是boot2docker)
我已经在VMware Warkstation上安装了Windows Server 2016 Technical Preview 4 。
它有2 GB的RAM和60 GB的磁盘空间。
我尝试根据官方Microsoft指令安装Docker的 Windows Server主机 。
图中一般的说明
我不需要一个Hyper-V容器技术,所以对于这个指南,我不需要做一个标有星号“*”的步骤
所以我们有6个步骤来安装Windows Server Host和Docker:
- 安装容器function
- 创build虚拟交换机
- configurationNAT
- configurationMAC地址欺骗
- 安装Container OS映像
- 安装Docker **
我在第二步中遇到了一个问题:在PowerShell中键入下一个cmdlet时创build虚拟交换机:
PS C:\> New-VMSwitch -Name "Virtual Switch" -SwitchType NAT -NATSubnetAddress 172.16.0.0/12
New-VMSwitch : Failed while adding virtual Ethernet switch connections. Internal miniport create failed, name = '8A407781-1BF5-4BB0-8538-35CFF056C598', friendly name = 'vEthernet (Virtual Switch)', MAC = 'DYNAMIC': One or more arguments are invalid (0x80070057). At line:1 char:1 + New-VMSwitch -Name "Virtual Switch" -SwitchType NAT -NATSubnetAddress ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-VMSwitch], VirtualizationException + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.NewVMSwitch
在这种情况下我该怎么办?
我能够安装docker使用微软指南关于自动安装,而不是使用手册指南 :
# Auto-install instruction. PS C:\> powershell.exe PS C:\> start-process powershell -Verb runas PS C:\> wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1 PS C:\> C:\Install-ContainerHost.ps1 -HyperV # Wrong!
但是在关键字-HyperV的最后一行有一个错误。
我们需要join它,所以最后一行看起来像:
PS C:\> powershell.exe PS C:\> start-process powershell -Verb runas PS C:\> wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1 PS C:\> C:\Install-ContainerHost.ps1 # Currect!
使用正确的指令,我能够安装docker。
我在第一次运行时在Nano服务器上发生了同样的错误:
PS C:\> New-VMSwitch -Name "Virtual Switch" -SwitchType NAT -NATSubnetAddress 172.16.0.0/12
SwitchType NAT绝对是正确的,因为该命令不接受除NAT switchtype以外的其他任何NATSubnetAddress参数。 再次运行它,然后在我的Nano服务器上运行。