How to solve the coexistence of VMware and docker under win10

Vmware has its own virtualization kernel, but Docker in win10 needs to rely on hyper-v. in essence, it is a conflict between Hyper-V and Vmware kernel. After all, they provide the same functions.

PS:

Installing Hyper-V service is actually not a simple task, especially when your system is win10 home version, you need to go through more processes, but it is also very simple:

Enable Hyper-v for win10 Home

pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

Named XXX CMD. Click Run, and the rest is that the machine needs to be restarted according to its needs.

How to solve the problem of non coexistence

During the development process, I need to experiment in VMware and docker. Conflicts cannot be avoided.

01 modify bcd

Method 1

Direct paste solution:

1. When you want to use VMware

bcdedit /set hypervisorlaunchtype off

2. When you want to use Docker

bcdedit /set hypervisorlaunchtype auto

reboot must be performed after each switch.

Under this method, the system functions and services should not be controlled, and do not try to switch manually

02 enable two booths, one with Hyper-V enabled and one without Hyper-V enabled

Method 2

It mainly uses the bcdedit startup item configuration

I'll write down the general idea:

(1) First, check and enable Hyper-V through programs and functions, so that Docker is available, but VM is not

(2) Copy a startup entry and disable Hyper-V (which probably means this, but not exactly) so that you can enter the system through two startup methods

(3) If the default login mode is used, the Docker VM is unavailable; Using the new startup method of replication, Docker is available, and VM is also available (I don't believe it at first, but it can)

Here are the specific operations:

Programs and features, enable or disable Windows features, and check Hyper-V

Open the cmd command window as an administrator (note the following code and execute it twice):

D1

win + X opens the command line. Note: it must be executed as an administrator

bcdedit /copy {default} /d "Windows 10 Without Hyper-V"

The above command gets the output {xxxxxxxxxxxxxxxx}

bcdedit /set {xxxxxxxxxxxxxxxxxxx} hypervisorlaunchtype off 

D2

Continue to the command line window (view all startup items):

bcdedit /enum

You can find an additional startup item.

Restart the computer. When you restart the computer again, you will see two startup options

At this point, select (no Hyper-V) to enter the system, and you will find that Docker and VM live in harmony.

03 upgrade Win10 2004 or above or LTSC 2021

Ultimate solution

VMARE Version upgrade to 15.5 above
WIN10 Upgrade to version 2004 or above
Hyper-V Is on

Install wsl2 -- Linux subsystem under windows.

Let docker run in WSL2 system, so it will not affect the preemption of Hyper-V with Vmware.

#Start PowerShell in administrator mode and run
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")
After these two installations are completed, restart directly!!!!!!!!! Restart!!!!!!
#Here is the name of the WSL1 you installed
wsl --set-version <Distro> 2
wsl -l -v
#You will be prompted that version is 2

Complete wsl configuration

Install Docker Desktop for windows and enable "Use the WSL2 based engine" in settings

A patch that needs to be patched with wsl2 may pop up during operation, and run wsl_update_x64.msi, just install it.

Final state

January 2022

Added by babybird11 on Mon, 17 Jan 2022 13:55:25 +0200