Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Add windows hyperv support. #1541

Closed
wants to merge 36 commits into from
Closed

Add windows hyperv support. #1541

wants to merge 36 commits into from

Conversation

pmario
Copy link

@pmario pmario commented Mar 14, 2016

It's based on: floradu88's PR. ... but I changed quite a lot. See info below.
also see: #1463 (comment)

Hard coded requirements

  • User needs to be part of the Hyper-V-Administrators group.
    • User needs elevated rights only once: When VM is created.
    • see: comment above point 3
  • The virtual switch needs to be named KitematicVirtualSwitch

Setup Kitematic VSwitch

  • Open the Hyper-V Manager Desktop App
  • If you need Internet Access, you'll probably need to use External Network!
  • see msdn Hyper-V on Windows for more info.
    • 03 kitematicvirtualswitch_

Add user to Hyper-V-Administrators group

  • Open your file explorer
  • right click This PC: Manage (You have to be Admin to do this !)
    • 01 right click this pc manage_
  • System Tools: Local Users and Groups: Groups
    • 02 manage groups hyper-v-admins_

@pmario
Copy link
Author

pmario commented Mar 14, 2016

Not tested, if VBox still works :)

@pmario
Copy link
Author

pmario commented Mar 15, 2016

this command: $(Get-VMSwitch | where {$_.SwitchType -eq "external"}).name will give us an existing switch, with the right parameters. ... So hard coded names will be obsolete.

@FrenchBen
Copy link
Contributor

Doesn't Get-VMSwitch require admin? How does this work for non-admin users?

@pmario
Copy link
Author

pmario commented Mar 16, 2016

No. As I wrote above it only needs Hyper-V-Administrators rights. So the user needs to be in this group. If you want to use hyper-v you need to be in this group anyway, since otherwise every command needs a boring elevated popup. ....

With the setting described above, I could reduce the elevated dialog. It's only needed, because docker-machine.exe has a hardcoded dependency. Which IMO is a bug! see my comment at: #1463 (comment) point 3

@FrenchBen
Copy link
Contributor

Thanks for the info - I had previously seen some of the elevated admin rights issues and had to ask. It's nice to see this as not being a problem with the user being in the proper group.

@pflannery
Copy link

Just some feedback when trying to run this on Windows 10 64bit.

  • I get an error first time about 'KitematicVirtualSwitch' not existing.
  • once I create the correct switch then it creates a hyper-v vm called 'default' (be nice to have a better name like kitematic or similar if possible)
  • after powershell has finished the 'default' vm is booted to command prompt but I get this error screen in kitematic (note: my user is in the hyper-v administrators group)

image

I tried the delete and retry button in kinematic but same issue.
Then tried docker-machine restart default which restarts the vm successfully, but kitematic still complains with above error.

boot2docker has a message Device "eth1" does not exist

image

@FrenchBen
Copy link
Contributor

Sounds like something changed in your setup since the VM was created? A missing device could indicate issues with communication - Check your HyperV settings and what device it uses to communicate with the VM

@pflannery
Copy link

I have an existing Fedora 23 Vm on hyper-v that can connect to the internet and it works great.
But when I try to setup with kinematic it automatically creates an extra switch which will never be able to get on to the internet because you can only share the internet with one switch

By changing the hard coded 'KitematicVirtualSwitch' switch name to use my existing switch name seems to of fixed this issue.

I now see this:

image

awesome to have this working with hyper-v!!

@pflannery
Copy link

@FrenchBen thanks

@pmario
Copy link
Author

pmario commented Mar 17, 2016

By changing the hard coded 'KitematicVirtualSwitch' switch name to use my existing switch name seems to of fixed this issue.

@pflannery thx for testing. ...

IMO a new test needs to be made:

  • search for an external switch with $(Get-VMSwitch | where {$_.SwitchType -eq "external"}).name ... and just take it.
  • If no switch fits, point the user to a help page.

What do you think?

@pmario
Copy link
Author

pmario commented Mar 17, 2016

once I create the correct switch then it creates a hyper-v vm called 'default' (be nice to have a better name like kitematic or similar if possible)

@FrenchBen .. I just used the same name, that's already used for VBox. But I also thought, it should be a different name eg: kitematic-default, kitematic-vm or just kitematic as suggested

It would also create better CLI commands eg: docker-machine start kitematic-vm or docker-machine start kitematic

@pmario
Copy link
Author

pmario commented Mar 17, 2016

awesome to have this working with hyper-v!!

Just to be sure: There is no directory sharing atm, since hyper-v doesn't provide this function.

…ternal vswitch list and use the first one, we find. This is the same behaviour as docker-machine.
radu.florescu added 4 commits April 15, 2016 15:24
…s installed.

Signed-off-by: radu florescu <radu.florescu@hotmail.com>
Signed-off-by: radu.florescu <radu.florescu@totaljobsgroup.com>
Signed-off-by: radu.florescu <radu.florescu@totaljobsgroup.com>
- when hyper-v exists is present and not virtualbox.
- when both hyper-v and virtualbox are missing.

Signed-off-by: radu.florescu <radu.florescu@hotmail.com>
floradu88 and others added 10 commits April 15, 2016 20:53
…on windows 10.

Signed-off-by: raduflorescu <radu.florescu@hotmail.com>
…e, but we can checkk for `fullyqualifiederrorid`.

Added Machine name when checking docker machine version.

Signed-off-by: raduflorescu <radu.florescu@hotmail.com>
Added defensive programming in accessing vbox.log

Signed-off-by: raduflorescu <radu.florescu@hotmail.com>
Signed-off-by: Mario Pietsch <pmariojo@gmail.com>
Signed-off-by: radu.florescu <radu.florescu@hotmail.com>
…not vbox is installed, because there is an exception thrown in the setup earlier.

Signed-off-by: radu.florescu <radu.florescu@hotmail.com>
Signed-off-by: Mario Pietsch <pmariojo@gmail.com>
@floradu88
Copy link

Could we check and merge this in?

@pmario
Copy link
Author

pmario commented May 19, 2016

Hi folks,
I'm closing this PR since it is (kind of) superseded by DockerForWindows and Kitematic auto detects hyper-v now.
have fun!

@pmario pmario closed this May 19, 2016
@floradu88
Copy link

floradu88 commented May 20, 2016

@pmario Hello, maybe next time is worth mentioning that before you spend time developing and test it. Could you please also include the link to the two things you mentioned above?

Also maybe next time we will have feedback on features that might not be visible to the outside contributors. I did not find any mention about the above feature.

@pmario
Copy link
Author

pmario commented May 20, 2016

@floradu88

Hello, maybe next time is worth mentioning that before you spend time developing and test it.

Please tell me, how I should have known this? ...

I still think the Kitematic / docker-machine "multi Platform / single software approach" has an advantage over the "locked in" native versions.


Here's the timeline as I see it. That's my point of view and may be totally wrong, since I don't have any knowledge about the real timeline and the people involved.

We probably started our approach to include hyper-v into Kitematic at about the same time frame as Docker created D4W. ... D4W concepts may be several months earlier.

January
The "unikernal guys" joined docker in January

February
Docker moved closer to alpine in February. .. which (btw) caused some confusion in the "ubuntu camp"

(fast forward May 2016: those groups seem to be responsible for a big part of the implementation

March
This PR started 14th March.

The first public post in the D4W discussion forum was created on 17th March.

Docker for Mac and Windows beta was announced at the end of March. ... I did request an invitation the same day.

April
April 3rd I got my link to test the beta. D4W was far away, from what it is now. ...

May 9th
This PR got the "postpone" label, which for me is very close to "no". In the sense of: "No" is temporary and "Yes" is forever ;)

May 10th
Kitematic 0.10.3 is the first version that supports Docker for Widnows natively.

You may find a "Docker for Windows" link here: https://forums.docker.com/t/docker-for-windows-beta-invites/9234/6 ... I don't know if it still works as intended.

@floradu88
Copy link

floradu88 commented May 20, 2016

@pmario I am not happy about this going to be wasted time in developing something that won't be used. They could have rejected this before we starting to put time and effort into it. A lot of guys like @FrenchBen and you were involved and everybody looked happy about this being done. But maybe I was wrong to think that. Thank you for the information! will install this new release and try to see if this works.

@FrenchBen
Copy link
Contributor

FrenchBen commented May 20, 2016

@floradu88 I completely understand the feeling and don't think the effort is completely wasted.
As @pmario mentioned the timing was less than ideal, as a lot of things happened almost concurrently.

One REALLY nice use-case for this PR would be to create a Windows server 2016 instance within Hyper-V and allow kitematic to communicate with it.
Allowing everything/everyone to slap any OS within HyperV and expect Kitematic to just 'work' is a bit more of a stretch, as each may have their own set of features/settings.

I'd be happy to pull this branch in under the main repo to make sure that the code/time spent remains relevant and doesn't go away (in case repo changes are made by either of you)

You both also have my email, so feel free to ping me offline if needed :)

@floradu88
Copy link

@FrenchBen I will be more than happy if this gets merged. @pmario what do you think about this?

@pmario
Copy link
Author

pmario commented May 26, 2016

@floradu88 As I did understand the comment from FrenchBen, he would pull the branch into the main repo, so it doesn't get lost. There wasn't the intention to merge it? @FrenchBen Or am I wrong here?

I don't have the intention to pull a windows server from the web. With my internet connection it takes hours not minutes to pull it. ... I think the ubuntu base images are way to big to be convenient. I use busybox, debian or now alpine. They still need minutes to be initialized the first time. In my opinion pulling gigabytes of images is just wasted time and super boring.

@floradu88
Copy link

@pmario Yes, pull it under the main repository.

@FrenchBen
Copy link
Contributor

FrenchBen commented May 27, 2016

Pulling it under the main repo, not merging :)
https://github.com/docker/kitematic/tree/1541-windows-hyperv

@pmario if you feel incline, here are some of the TP5 setup steps:
https://forums.docker.com/t/windows-server-2016-tp5-docker-server-remote-management/10315/6

@floradu88
Copy link

floradu88 commented Jun 13, 2016

@FrenchBen I am sorry to say this, but the latest docker version is not working out of the box:
"Error: getaddrinfo ENOTFOUND docker.local docker.local:2375" with hyper-v, it fails and suggests to use virtualbox. Any idea why?

Maybe docker for windows beta is better. I am waiting to get my hands on that one. Until then, I will try to use this to work with hyper-v.

@FrenchBen
Copy link
Contributor

@floradu88 The windows check for the Docker for Windows isn't the best - If you have suggestions on how I could make it better, I'm open to suggestions.
The issue is detecting whether the user forgot to enable Docker for Windows or it simply doesn't exist.
Right now it's setup to try and assumes the user forget to start it.

Thoughts?

@floradu88
Copy link

I will start from master and debug it to see why this is failing. Will create a pull request with fixes, if I manage to fix it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants