Docker and VMWare Workstation on the same Windows machine

The task was simple, put Docker on my working Windows laptop, which already has a zoo. I installed Docker Desktop and created containers, everything is ok, but I 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.

The work has stopped, it is urgent to repair

Docker and VMWare Workstation on the same Windows machine

By googling, it was found out 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 like this mend, with a link to the Microsoft Knowledge Base Manage Windows Defender Credential Guard. The solution is to disable Defender Credential Guard (item 4 of the Disable Windows Defender Credential Guard section helped me):

mountvol X: /s
copy %WINDIR%System32SecConfig.efi X:EFIMicrosoftBootSecConfig.efi /Y
bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "EFIMicrosoftBootSecConfig.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 restarting, Windows will ask if you really want to disable Defender Credential Guard. Yes! In this way, VMWare Workstation will return to normal operation, and we will find ourselves in the same place as before installing docker.

I have not found a solution on how to reconcile Hyper-V and VMWare Workstation, I hope they will become friends in new versions.

Another way

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

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

I won’t retell the installation instructions especially, only the list of ingredients:

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

Yes, Docker Desktop, unfortunately, will also be 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 escalation of rights when they need it, but all 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 dev virtualka will be created inside which will be Docker.

This virtual machine can be attached to the VMWare Workstation GUI by opening the corresponding vmx file. But this is not necessary, because VSCode will now need to run a PowerShell script (for some reason, my docker-machine and docker-machine-driver-vmwareworkstation ended up in the bin folder):

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

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

Difficulties:

In the process of creating docker-machine, the process hung for me:

Waiting for SSH to be available...

Docker and VMWare Workstation on the same Windows machine

And after a while it ended with an excess of attempts to establish a connection with the virtual machine.

It's all about certificate policy. When creating a virtual machine, you will have a ~.dockermachinemachinesdev directory 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 thinks they have permission issues. Only docker-machine will not tell you anything about this, but will simply reconnect until it gets bored.

Decision: As soon as the creation of a new virtual machine begins, we go to the ~ .dockermachinemachinesdev directory and change the rights to the specified files, one at a time.

The file must be owned by the current user, only the current user and SYSTEM have full access, all other users, including the administrators group and the administrators themselves, must be deleted.

There may also be problems converting absolute paths from Windows to Posix format, and binding volumes containing symbolic links. But that is another story.

Source: habr.com

Add a comment