If you want to use Docker under Windows and, especially, the new Windows Sandbox feature in the Windows May 2019 Update (but only available in the Pro, Enterprise, or Education edition), you have to enable Hyper-V support.

The new Windows Sandbox is a lightweight virtual machine using Microsoft’s hypervisor using the same OS image as the one on your machine. Every time you launch the feature, it runs a new clean installation of Windows 10. When you finish testing an application and close Windows Sandbox, everything gets deleted automatically. Also, using virtualization isolates anything occurring inside the environment from your main installation offering maximum security to test untrusted applications.

To use it, you have to enable Windows-Sandbox as a Windows-Feature. Read all about it here. At the moment, there exists a bug that may affect your usage of the Sandbox in Windows 10 (Update: this bug seems to be fixed with the optional cumulative Windows update KB4512941).

The problem for many people is, that running VMware Workstation or VirtualBox and Hyper-V is not possible at the same time. But this can be, more or less, easily be fixed by creating two boot configurations, where one has Hyper-V enabled and one has not.

Hyper-V support can easily be switched on or off by using the commands

bcdedit /set hypervisorlaunchtype auto

or

bcdedit /set hypervisorlaunchtype off

For these settings to take effect, you have to reboot your system, though. So the best idea may be to create two different boot configurations, one with Hyper-V enabled and one without.

Starting from a boot configuration where Hyper-V is not enabled, you can create a new boot configuration by entering these commands in an elevated prompt:

bcdedit /set hypervisorlaunchtype off

bcdedit /copy {current} /d "Windows 10 (Hyper-V)"

The output of the last command is a message similar to this one:

The entry was successfully copied to {965644a8-762d-41b2-8eea-2b14fd396d56}

You can now use the displayed uuid of the newly created boot configuration to enable Hyper-V in the new configuration:

bcdedit /set {965644a8-762d-41b2-8eea-2b14fd396d56} hypervisorlaunchtype auto

This way, you can decide at boot time if you want to use Docker and the Sandbox or VMware. And if you want the newly created boot configuration to be the default one, just use this command:

bcdedit /default {965644a8-762d-41b2-8eea-2b14fd396d56}

Optionally, you can set the name of the current boot option to something more descriptive

bcdedit /set {current} description "Windows 10 (VMware)"

and shorten the timeout

bcdedit /timeout 5

You may have to enable the Hyper-V role which can also be done using the command line:

DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V

 

Where to go from here

BCDEdit Command-Line Options

How to use Windows Sandbox in the Windows 10 May 2019 Update

Sandbox broken in Windows 10 May 2019 Update

Cumulative Windows Update KB4512941