[Environment construction] Docker startup error! Steps to enable Hyper-V and start Docker again

Error occurred when starting Docker

I want to use Docker to build a virtual environment, but I had to use VMware, so I used VMware for a while. Development has settled down, so when I tried to start using Docker, a picture of a Docker whale with its cheeks dyed red was displayed on both the error screen. I disabled Hyper-V when using VMware, so I think that's the effect.

マウント確認.png This time, I have summarized the necessary steps when the above error occurs!

environment

environment version
Windows10 1909
Docker(Community Edition 18.06.1
VMware Workstation 15 -

solution

If the value of hypervisorlaunchtype that can be confirmed by executing bcdedit is "Off", Execute $ bcdedit / set hypervisorlaunchtype auto in PowerShell started with administrator privileges, and then restart the PC!

What i did

  1. An error occurs when starting Docker
  2. Check whether Hyper-V and virtualization are enabled or disabled
  3. Check the status with bcdedit
  4. Reboot & Docker launch

Details

1. An error occurs when starting Docker

マウント確認.png When I started Docker, an error was displayed. When I checked the link, I found the word BIOS in the Virtualization column. Since it is ** A **, check the current PC status.

2. Check whether Hyper-V and virtualization are enabled or disabled

マウント確認.png * The right window is my setting Hyper-V is enabled. マウント確認.png * The right window is my setting Virtualization was also enabled.

3. Check the status with bcdedit

I also tried restarting the PC and checking the settings with commands, but the situation did not change.

When I looked it up again, I found that there were many cases where an error occurred even though Hyper-V was enabled. So, in light of the article below, I found that I needed to see the value of hypervisorlaunchtype, which I could see with the bcdedit command.

[Docker] Error handling when installing Docker for Windows https://qiita.com/LemonmanNo39/items/b1b104e7fb609464727b

マウント確認.png When I actually checked it, it was `hypervisorlaunchtype Off`, so execute the following command with Powershell started with administrator privileges.
#Switch hypervisor launch type
bcdedit /set hypervisorlaunchtype auto

4. Reboot & Docker launch

マウント確認.png When I started Docker after restarting the PC, it started up safely. I was able to start the container without any problems.

Supplement

■ What is bcdedit or hypervisor launchtype?

** bcdedit **: Command to check the information (BCD) at PC startup ** hypervisorlaunchtype **: Hyper-V enable / disable setting value

What I ran with Powershell earlier is that I checked the settings with the bcdedit command and enabled Hyper-V.

Reference: ■ Change the display order and default of the boot menu with bcdedit on Windows  https://www.atmarkit.co.jp/ait/articles/0905/08/news096.html ■ Back up / restore boot configuration information with bcdedit  https://www.atmarkit.co.jp/fwin2k/win2ktips/1157bcdedit2/bcdedit2.html ■ Temporarily disable Hyper-V to use other virtual environments  https://www.atmarkit.co.jp/ait/articles/1511/13/news032.html

■ Didn't you enable Hyper-V a while ago ...?

ʻEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -Allcommand What is the difference between thebcdedit / set hypervisorlaunchtype auto` command? Regarding this, the former is the setting of enabling / disabling Hyper-V, and the latter is the setting of starting Hyper-V. Therefore, even if hypervisorlaunchtype auto is set to auto Enable-WindowsOptionalFeature -Online -FeatureName If Microsoft-Hyper-V setting is OFF I thought that docker could not be used.

Verification
1. First, disable & restart Hyper-V

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

2. After restarting, check the value.

(image) Hyper-V is unchecked.

3. Check the bcdedit command

→ There was no value for hypervisorlaunchtype.

4. When I start docker in this state, an error is displayed

The value of hypervisorlaunchtype doesn't seem to be displayed unless Hyper-V is enabled.

■ The basics of Hyper v to understand from troubles P8  https://www.slideshare.net/NaokiAbe/hyper-v-25767921

5. After enabling Hyper-V, restart. Check the value of bcdedit.

It was hypervisorlaunchtype Auto.

6. Start docker.
マウント確認.png Start up safely.

From the above, when using Docker, it seems necessary to ** set Windows Hyper-V ON → hypervisor launch type is Auto **.

Now that Docker is available, I would like to develop it again! Well then!

reference

■Logs and troubleshooting  https://docs.docker.com/docker-for-windows/troubleshoot/#virtualization-must-be-enabled ■ Enable / disable the Windows 10 role in PowerShell  http://www.vwnet.jp/windows/w10/WindowsOptionalFeature.htm ■ [Docker Desktop] What to do if you cannot start due to an error  https://algorithm.joho.info/programming/docker-for-windows-hardware-assisted-virtualization-and-data-execution-protection-must-be-enabled-in-the-bios/ ■ Enable the virtualization platform "Hyper-V" on Windows 10  https://www.atmarkit.co.jp/ait/articles/1806/25/news026.html

Recommended Posts

[Environment construction] Docker startup error! Steps to enable Hyper-V and start Docker again
Note: [Docker] How to start and stop
Docker + DynamoDB local + C ++ environment construction and practice
Kaggle environment construction using official Docker and vscode
A reminder of Docker and development environment construction
Docker environment construction
Environment construction of keras and tensorflow, jupyter lab by docker and connection to jupyter by port forwarding
Rails Docker environment construction
[Rails 6.0, Docker] I tried to summarize the Docker environment construction and commands necessary to create a portfolio
Easy environment construction of MySQL and Redis with Docker and Alfred
Build a Node-RED environment with Docker to move and understand
MySQL 5.7 (Docker) environment construction memo
Introduction to Metabase ~ Environment Construction ~
Redmine (Docker) environment construction memo
[Docker] Rails 5.2 environment construction with docker
Docker × Spring Boot environment construction
[Docker] postgres, pgadmin4 environment construction
React environment construction with Docker
Until you build the docker environment and start / stop the Ubuntu container
PostgreSQL environment construction with Docker (from setup to just before development)