How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows

Posted on

Introduction

This is an article where the subject or the topic is a specific one as it exist in the title of the article. The content of this article is very useful in order to be able to define a path exist in the local device. That path definition in the local device is for the volume path definition. Specifically, the volume path definition in a ‘docker-compose.yml’ file. The definition is for the folder or path location exist in the local device running using Microsoft Windows operating system. In order to define it, the Docker Desktop Application running must use Hyper-V engine. So, if the engine of the Docker Desktop Application is a Hyper-V engine, the sub-menu with the label of ‘File Share’ will appear under the Resources menu in the Settings window.

How to Change Docker Desktop Application Engine from WSL 2 to Hyper-V Engine

The following is the actual step for changing the engine of a Docker Desktop Application from WSL 2 to Hyper-V engine :

  1. First of all, just run the Docker Desktop Application. It will appear as in the following image :

    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows

    When it starts normally, the Docker Desktop Application will appear as in the following image :

  2. Following after, just access the Settings window of the Docker Desktop Application. In order to do that, click the button exist as in the following image :

    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
  3. Next, ffter clicking the Settings button, the following Settings window of the Docker Desktop Application will appear :

    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
  4. Continue on, before switching the engine, just check the appearance of the sub-menu inside the Resources menu. The appearance will exist as follows :

    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows

    In the image appearance above, there is no File Sharing sub-menu in the Resource menu. It is the the appearance of the Resource menu for Docker Desktop Application which is using WSL 2 based engine. This can cause a problem for defining the volume definition in the ‘docker-compose.yml’. Especially, if the value of the volume definition is mapping the path of the host or the directory, folder location of the local device. First of all, it need a definition in the File Sharing sub-menu. For the File Sharing sub-menu to appear, the Docker Desktop Application must use the Hyper-V engine.

  5. So, in order to switch the engine from WSL 2 based engine into Hyper-V engine, just uncheck the checkbox with the label ‘Use the WSL 2 based engine. Suddenly, the General window’s appearance of the Settings from Docker Desktop Application will change. The change is that the Apply & Restart button will be active as follows :

    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
  6. Last but not least, do not forget to click the button with the label of ‘Apply & Restart’. Just wait for several seconds for Docker Desktop application to restart. If it does not have any further error message, the Docker Desktop Application  will back run to normal. But in the Resources menu, the sub-menu are not the same anymore. It will have a sub-menu with the label of ‘File Sharing’ as follows :

    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows
    How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows

One thought on “How to Change Docker Desktop Application Engine from WSL 2 based Engine to Hyper-V Engine as Backend in Microsoft Windows

Leave a Reply