Using Docker in a Hyper-V image can be that easy – if you know how to do that. The use case is quite simple: imagine you have a company or private infrastructure that runs on a server. This server runs multiple instances of Windows (Server) where one instance is used for developing and another for testing. Now if the assignement is to create a Docker image that runs your application than you might have the same problems that I had – I didn’t work on a fast try. So here is the short and simple solution of a few hours of trying and searching.
Preferences Hyper-V Host
- Start Hyper-V-Manager
- Write down name of the image that should run Docker for Windows
- Download the following script
https://github.com/MicrosoftDocs/Virtualization-Documentation/blob/live/hyperv-tools/Nested/Enable-NestedVm.ps1 - Open powershell as Administrator
- Execute script
powershell -ExecutionPolicy Bypass -File .\Enable-NestedVm.ps1 {Hyper-V-image-name-that-should-run-Docker} Explaination -ExecutionPolicy Bypass: by default, no one is allowed to execute unsigned scripts, so bypass this setting. Just try it out without this parameter and you will see the response. -File: the file to execute
Preferences Hyper-V Image
- Enable Windows Features
+ Containers
+ Hyper-V - Download
https://docs.docker.com/docker-for-windows/install/ - Install Docker
- Concratulation, you successfully installed Docker in a Hyper-V image!