Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyper-V Get-VMHost -ComputerName localhost #1077

Closed
Laruxo opened this issue Sep 7, 2017 · 8 comments
Closed

Hyper-V Get-VMHost -ComputerName localhost #1077

Laruxo opened this issue Sep 7, 2017 · 8 comments

Comments

@Laruxo
Copy link

Laruxo commented Sep 7, 2017

Expected behavior

Docker starts

Actual behavior

Docker fails to start

Information

65249CEF-95DE-471A-A1F8-BC2C4684F506/2017-09-07_22-07-26

Windows 10 Education. When starting Docker I receive an error that pointed me to command
Hyper-V\Get-VMHost -ComputerName localhost in C:\Program Files\Docker\Docker\resources\MobyLinux.ps1.

When running it I receive error:

Hyper-V\Get-VMHost : Hyper-V encountered an error trying to access an object on computer 'localhost' because the
object was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the
computer is running.
At line:1 char:1
+ Hyper-V\Get-VMHost -ComputerName localhost
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-VMHost], VirtualizationException
    + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.GetVMHost

I tried running several variations of the same command: Hyper-V\Get-VMHost or Hyper-V\Get-VMHost -ComputerName . and both of them work fine.

So I tried editing mentioned file and removing all results of -ComputerName localhost.
And now Docker starts successfully.

Steps to reproduce the behavior

(on my machine, no idea what is so special about it)

  1. Open PowerShell
  2. Run command Hyper-V\Get-VMHost -ComputerName localhost
  3. Also try running command Hyper-V\Get-VMHost which will work
@jasonbivins
Copy link

Hi @Laruxo

Since you're on an Education edition of Windows - you might not have all the Hyper-V features installed.

Try running this from an elevated powershell prompt, then rebooting and reinstalling Docker.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

@Laruxo
Copy link
Author

Laruxo commented Sep 8, 2017

Hello @jasonbivins
I have already disabled and enabled hyper-v several times (using Windows Features and this command). Tried it again just now and I can see that all its features are installed and enabled.

@BatmanAMA
Copy link

BatmanAMA commented Nov 5, 2017

I can confirm that this happens for me as well. I tried on stable and edge and get the same issue - I have an edited version of the powershell file if you'd like a PR.

docker version

Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64

docker version (edge)

Client:
Version: 17.11.0-ce-rc2
API version: 1.34
Go version: go1.8.4
Git commit: d7062e5
Built: Wed Nov 1 22:08:18 2017
OS/Arch: windows/amd64

gcim win32_operatingsystem | select Caption, Version, OSArchitecture | fl

Name : Microsoft Windows 10 Pro
Version : 10.0.15063
OSArchitecture : 64-bit

@Nicofuma
Copy link

Nicofuma commented Jan 28, 2018

Hello, I have the same issue too:
Hyper-V\Get-VMHost -ComputerName localhost fails but both Hyper-V\Get-VMHost and Hyper-V\Get-VMHost -ComputerName <real computer's name> succeeded. So I solved my issue by removing the -ComputerName localhost part everytime localhost is used. I also had to run the script manually as admin otherwise it would fail at some point in one of the command I altered.

docker version

Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:05:22 2017
OS/Arch: windows/amd64

gcim win32_operatingsystem | select Caption, Version, OSArchitecture | fl

Caption : Microsoft Windows 10 Professionnel
Version : 10.0.16299
OSArchitecture : 64 bits

@kanczler
Copy link

kanczler commented Mar 22, 2018

So I solved my issue by removing the -ComputerName localhost part everytime localhost is used

This worked for me, thanks!

@Kriknav
Copy link

Kriknav commented Apr 19, 2018

I just recently installed Docker for Windows on my work PC, which is Windows 10 Pro 10.0.16299 and I had issues like the one above enabling Linux containers. I tried changing the "localhost" to the reported machine name (the name listed if I just did "Hyper-V\Get-VMHost", since there is only one returned) and I still got the same error. I solved it by removing the "-ComputerName" for all commands listed in the file MobyLinux.ps1 in the "function New-MobyLinuxVM { }" and it worked. Hope this helps.

@docker-robott
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants