自从我将计算机上的 Docker 升级到 beta27 以来,我一直无法使用默认网络运行 Windows 容器。我收到以下消息:
docker: Error response from daemon: container xxx encountered an error during Start failed in Win32: The system cannot find the path specified. (0x3): Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
Run Code Online (Sandbox Code Playgroud)
我已经卸载/删除了所有内容(Windows 版 Docker、Hyper-V、容器功能以及遗留在 C:\ProgramData\Docker 中的文件),然后重新安装了所有内容,但问题仍然存在。
我意识到nat适配器不再存在于 Hyper-V 中,但DockerNat适配器存在。
本文提供了一个脚本来重置网络组件,但我无法删除容器网络。
PS C:\WINDOWS\system32> Get-ContainerNetwork
Name Id Subnets Mode SourceMac DNSServers DNSSuffix
---- -- ------- ---- --------- ---------- ---------
nat 12706897-fc71-41fc-9046-a7be0d01727e {172.16.0.0/12} NAT
PS C:\WINDOWS\system32> Get-ContainerNetwork | Remove-ContainerNetwork
Confirm
Remove-ContainerNetwork will remove the container network "".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Remove-ContainerNetwork : Unspecified error
At line:1 char:24
+ Get-ContainerNetwork | Remove-ContainerNetwork
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Remove-ContainerNetwork], VirtualizationException
+ FullyQualifiedErrorId : OperationFailed,Microsoft.Containers.PowerShell.Cmdlets.RemoveContainerNetwork
PS C:\WINDOWS\system32> Remove-ContainerNetwork -Name nat
Confirm
Remove-ContainerNetwork will remove the container network "nat".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Remove-ContainerNetwork : Unspecified error
At line:1 char:1
+ Remove-ContainerNetwork -Name nat
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Remove-ContainerNetwork], VirtualizationException
+ FullyQualifiedErrorId : OperationFailed,Microsoft.Containers.PowerShell.Cmdlets.RemoveContainerNetwork
PS C:\WINDOWS\system32>
Run Code Online (Sandbox Code Playgroud)
是否有我可以删除的注册表项来删除网络,因为它无法通过 PowerShell 删除它?
小智 3
尝试使用以下命令删除 NAT 网络:
Get-NetNat | Remove-NetNat
Run Code Online (Sandbox Code Playgroud)
您也可以尝试重新启动HNS和docker
Restart-Service hns
Restart-Service docker
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3920 次 |
| 最近记录: |