Docker Machine 錯誤: Hyper-V PowerShell Module 不可用



我已经检查了我的Hyper-V设置,并且启用了PowerShell模块。我还发现了这个记录在案的问题:https://github.com/docker/machine/issues/4342 但这不是同一个问题,因为我没有安装VMware PowerCLI。该问题已通过推送回购而关闭,并且据说已在 0.14.0-rc1 中修复,构建 e918c74,所以我还是尝试了一下。更换我的 docker 机器后.exe,我仍然收到错误,即使重新安装 Windows 版 Docker 仍然收到错误。

有关更多背景信息,此错误在重新安装后开始发生,因为我的 Docker 安装出现错误:https://github.com/docker/for-win/issues/1691,但是,重新安装后我不再遇到该问题。

对于那些在Windows中遇到此问题的人,请按照此处的说明进行操作

在 win10 上使用 docker-machine 创建 Hyper-v VM 时,返回错误"预创建检查错误:"Hyper-V PowerShell 模块不可用"。

解决方案非常简单。原因是码头工人机器程序的版本。将其替换为 v0.13.0。具体操作如下:

  1. 下载 0.13.0 版本的 docker-machine 命令。点击下载:32位系统或64位系统

  2. 下载完成后,重命名并替换"C:\Program Files\Docker\Docker\resources\bin"目录中的"docker-machine.exe"文件。最好备份原始文件。

这是解决方案

https://github.com/docker/machine/releases/download/v0.15.0/docker-machine-Windows-x86_64.exe

将下载的文件保存到包含 docker-machine.exe 的现有目录中。

对于我的系统,这是docker-machine.exe的位置 /c/Program Files/Docker/Docker/Resources/bin/docker-machine.exe

备份旧文件并将其替换为新文件。

cp docker-machine.exe docker-machine.014.exe

将下载的文件名重命名为 docker-machine.exe

mv docker-machine-Windows-x86_64.exe docker-machine.exe

构建说明

  1. 在名为 myswitch 的 Hyper-V 管理器中创建虚拟交换机
  2. 请求 Docker 创建名为 myvm1 的 VM

docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1

结果

docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1

Running pre-create checks... (myvm1) Image cache directory does not exist, creating it at C:UsersTrey Brister.dockermachinecache... (myvm1) No default Boot2Docker ISO found locally, downloading the latest release... (myvm1) Latest release for github.com/boot2docker/boot2docker is v18.05.0-ce (myvm1) Downloading C:UsersTrey Brister.dockermachinecacheboot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.05.0-ce/boot2docker.iso... (myvm1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% Creating machine... (myvm1) Copying C:UsersTrey Brister.dockermachinecacheboot2docker.iso to C:UsersTrey Brister.dockermachinemachinesmyvm1boot2docker.iso... (myvm1) Creating SSH key... (myvm1) Creating VM... (myvm1) Using switch "myswitch" (myvm1) Creating VHD (myvm1) Starting VM... (myvm1) 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 FilesDockerDockerResourcesbindocker-machine.exe env myvm1

(1(,V0.15 正式修复了这个问题:修复问题 #4424 - 预创建检查:">Hyper-V PowerShell 模块不可用"官方介绍:https://github.com/docker/machine/pull/4426要加载 V0.15 的地址https://github.com/docker/machine/releases

(2(、我测试了这个,它工作正常。无需重启码头工人"docker-machine.exe"替换为 0.15 版本后立即生效

(3(,备份原始的是一个好习惯

如果您使用的是Windows,只需启动docker桌面

最新更新