You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Linux宿主机的Windows 10虚拟机中运行Docker?

Can You Run Docker in This Scenario?

Absolutely—Docker works perfectly in your Windows 10 VirtualBox VM. The error you’re seeing is fixable; it usually stems from daemon startup issues, permission problems, or compatibility conflicts between VirtualBox and Docker’s default settings. Let’s walk through the solutions step by step.

Common Causes & Fixes

1. Hyper-V Conflict with VirtualBox

VirtualBox and Hyper-V are incompatible, and Docker Desktop enables Hyper-V by default when using WSL2. This can break both your VM’s functionality and Docker’s daemon startup. Here’s how to resolve it:

  • Open Command Prompt as Administrator in your Windows 10 VM.
  • Run this command to disable Hyper-V:
    bcdedit /set hypervisorlaunchtype off
  • Restart your Windows VM.
  • Reconfigure Docker Desktop to use Windows containers (not WSL2):
    1. Open Docker Desktop Settings > General.
    2. Uncheck "Use the WSL 2 based engine".
    3. Click "Apply & Restart" to save changes.

2. Ensure the Docker Daemon is Running

The error explicitly calls out that the daemon might not be active. Let’s troubleshoot this:

  • Check the Docker service status: Press Win+R, type services.msc, and look for "Docker Desktop Service". If it’s stopped, right-click it and select "Start".
  • If the service fails to start, check Docker logs for clues: Go to Docker Desktop > Troubleshoot > View Logs. Look for lines referencing startup failures (common issues include corrupted installations or missing dependencies).
  • If logs point to corruption, reinstall Docker Desktop: Uninstall it completely, restart the VM, then download the latest stable version and install it (make sure to uncheck WSL2 during setup).

3. Fix Permission Issues

By default, the Docker client needs elevated privileges to connect to the daemon. Try these steps:

  • Close all open terminals, then launch PowerShell as Administrator (right-click Start > Windows PowerShell (Admin)).
  • Test your docker build command again in this elevated window.
  • To avoid needing admin access every time, add your user to the docker-users group:
    1. Open Computer Management (right-click Start > Computer Management).
    2. Navigate to Local Users and Groups > Groups > docker-users.
    3. Add your user account to the group, then restart the VM for changes to take effect.

4. Verify the Docker Connection

After applying the fixes, confirm everything is working:

  • Run docker info in your terminal. If it returns system details instead of an error, the daemon connection is successful.
  • Test container functionality with docker run hello-world—this should pull and run a test container without issues.
Alternative: Linux Containers (Optional)

If you don’t strictly need Windows-specific .NET Framework features, you could switch to a Linux VM (hosted in VirtualBox) and use Linux containers instead. They’re lighter and often more compatible with .NET Core workflows. But since your project requires .NET Framework, sticking with Windows containers is the right call.

内容的提问来源于stack exchange,提问作者tVoss42

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:13:27