Docker and VMWare Workstation on the same Windows machine

The task was simple, put Docker on your working laptop with Windows, which already has a zoo. Delivered Docker Desktop created containers, everything is ok, but just quickly discovered that VMWare Workstation stopped running virtual machines with an error:

VMware Workstation and Device/Credential Guard are not compatible. VMware Workstation can be run after disabling Device/Credential Guard.


Work got up, urgent need to be fixed




Using Google, it was found that this error occurs due to the incompatibility of VMWare Workstation and Hyper-V on the same machine. The problem is known and there is an official VMWare solution on how to fix it , with reference to the Microsoft Manage Windows Defender Credential Guard knowledge base . The solution is to disable the Defender Credential Guard (paragraph 4 of the Disable Windows Defender Credential Guard section helped me):

mountvol X: /s
copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:
mountvol X: /d

After the restart, Windows will ask if it is really possible to disable Defender Credential Guard. Yes! Thus, VMWare Workstation will return to normal operation, and we will be in the same place as before installing the docker.

I never found solutions to reconcile Hyper-V and VMWare Workstation, I hope they will make friends in new versions.

Another way


I have long been hooked on VMWare Workstation for various purposes, tried to get down on Hyper-V and VirtualBox, but the functionality did not satisfy my tasks, so I still sit. It turned out there is a solution to how to bring together VMWare, Docker and VSCode in one working environment.

Docker Machine - allows you to run the Docker Engine on a virtual host and connect to it both remotely and locally. And for him there is a compatibility driver with VMWare Workstation, a link to GitHub

I will not particularly retell the installation instructions, only a list of ingredients:

  1. Docker Toolbox ( Docker Machine included)
  2. Docker Machine VMware Workstation Driver
  3. Docker desktop

Yes, Docker Desktop, unfortunately, is also needed. If you demolished it, then install it again, but this time removing the checkbox about making changes to the OS so as not to break VMWare Workstation again.

I want to note right away that everything works fine from a simple user, the installation programs will ask for an escalation of rights when they need to, but all the commands on the command line and scripts are executed from the current user.

As a result, the team:
$ docker-machine create --driver=vmwareworkstation dev

from Boot2Docker a virtual dev will be created inside of which there will be a Docker.

You can attach this virtual machine to the VMWare Workstation graphical interface by opening the corresponding vmx file. But this is not necessary, because VSCode will now need to be run by PowerShell with a script (for some reason, docker-machine and docker-machine-driver-vmwareworkstation turned out to be in the bin folder):

cd ~/bin
./docker-machine env dev | Invoke-Expression
code

VSCode opens to work with code on the local machine and docker in the virtual machine. The Docker for Visual Studio Code plugin allows you to conveniently manage containers in a virtual machine without climbing into the console.

Difficulties:

In the process of creating docker-machine, my process freezes:

Waiting for SSH to be available...



And after some time it ended with exceeding attempts to establish a connection with the virtual machine.

It's all about the politics of certificates. When creating a virtual machine, you will see the directory ~ \ .docker \ machine \ machines \ dev in this directory there will be certificate files for connecting via SSH: id_rsa, id_rsa.pub. OpenSSH may refuse to use them because it believes that they have access rights problems. Only here docker-machine will not tell you anything about this, but will simply reconnect until it gets bored.

Solution: As soon as the creation of a new virtual machine starts, go to the ~ \ .docker \ machine \ machines \ dev directory and change the rights to the specified files, one at a time.

The owner of the file should be the current user, full access only to the current user and SYSTEM, all other users, including the group of administrators and the administrators themselves, must be deleted.

There may also be problems with converting absolute paths from the Windows format to Posix, and with binding volumes containing symbolic link. But that's another story.

All Articles