Docker Desktop on a MacBook with Bootcamp

Docker Desktop on a MacBook with Bootcamp

How to Get Docker Desktop to Run in Windows 10 Under Bootcamp on MacBook Pro

As a software engineer, I develop applications within the Linux docker containers. The machine I develop on is an Intel i7 Macbook Pro within Windows 10 Pro installed via Bootcamp, and starts Windows 10 by default.

Docker Desktop for Windows installs just fine. The issue occurs when trying to open and run Docker Desktop for Linux Containers. The following error occurs "Hardware assisted virtualization and data execution protection must be enabled in the BIOS".docker_error - Hardware assisted virtualization and data execution protection must be enabled in the BIOS

This error initially confused me to start off with as I am using an Intel i7 CPU and assumed that it would support virtualization. So I checked the hardware by opening up 'Task Manager' (right click on menu bar and select 'Task Manager'). Selected 'Performance' and was amazed by what I was looking at.

bootcamp task manager

Virtualisation is actually disabled, but Hyper-V is supported, How weird! I wondered if this was an apple thing that disabled this in Bootcamp. I then decided to restart into Mac OSX, install Docker Desktop for Mac and run it. WOW it works just fine.

I then restarted the computer to automatically load into Windows and tried it again, and again the same error. So after checking the internet and all answers I found didn't help at all, I decided to leave it at that. After about a week when i was doing some work in Mac OSX I needed to restart into Windows, so instead of using my usual method, holding down 'Option Key' while restarting and selecting the Operating system. I opened up 'System Preferences' and selected 'Startup Disk'

Mac System Preferences

Then selected 'BOOTCAMP Windows'. Then clicked Restart.

startup disk

Once back using Windows, and after I finished doing what i needed to do, for some reason (for which I cant remember why exactly) I decided to open up 'Task Manager' and again i could believe what I saw.

Now oddly Virtualisation is Enabled. How could this be?

taskman

Docker Desktop was started and to my surprise it actually worked! Docker is now actually running Linux Containers in Windows under Bootcamp.

Note: When Restarted either using Option Key or Automatically into Windows, Virtualisation is Disabled

Conclusion

Virtualisation must be disabled automatically by Bootcamp when either using the Option Key on start or when Windows is started by default. I believe that when Mac OSX is loaded Virtualisation is enabled and when you select to restart into Windows from Mac OSX System Preferences it must keep virtualisation enabled.

Note: if using Windows Containers then Virtualisation can be disabled but Docker Desktop must be already set to Windows Containers as Linux is Default.

Quick Steps:

  • Start into Mac OSX
  • Open System Preferences
  • Open Startup Disk
  • Select Windows
  • Click Restart

And now Virtualisation should be enabled and Docker Desktop should now run for Linux Containers. This is the easiest and non technical method. However there is another way, that is more technical, that is to set enable_and_lock_vmx efi entry to 'true' by using a application called rEFInd within Mac OSx, but thats outside this article.

That Developer Guy

Website:

Leave a Reply

Your email address will not be published. Required fields are marked *

two × 5 =

Copyright © 2024 | Powered by WordPress | ConsultStreet theme by ThemeArile