docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.84k stars 281 forks source link

Enabling useless Hyper-V feature while updating #13830

Open xolider opened 7 months ago

xolider commented 7 months ago

Description

Hello, When Docker Desktop is already installed and running through WSL 2, and when we update Docker Desktop to a newer version, the update installer enables Hyper-V without asking for it.

Reproduce

  1. Install Docker Desktop and enable it to run through WSL
  2. Update to a newer version of Docker Desktop through the UI
  3. Let it updating normally
  4. While updating, it turns on Hyper-V features

Expected behavior

If Docker Desktop is configured to run over WSL, it shouldn't enable Hyper-V while updating

docker version

Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:32:48 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.25.2 (129061)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:16 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.23.0-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.9
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.9
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 20
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.10.102.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.59GiB
 Name: DESKTOP-5VNJ3UM
 ID: d7073a84-beb3-4ff3-831a-79b15af459df
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile

Diagnostics ID

BC38B957-96E4-46C1-9297-6B66550FE909/20231206185701

Additional Info

No response

10Dev commented 7 months ago

WSL2 uses the Hyper-V Hypervisor as a mandatory architecture requirement. A side effect of this is that because Hyper-V is a Type 1 Hypervisor, Windows itself ends up running in a VM as well as WSL 2.

So the checkbox you mention is just turning on some management features and the ability to create your own additional VMs

xolider commented 7 months ago

WSL2 uses the Hyper-V Hypervisor as a mandatory architecture requirement. A side effect of this is that because Hyper-V is a Type 1 Hypervisor, Windows itself ends up running in a VM as well as WSL 2.

So the checkbox you mention is just turning on some management features and the ability to create your own additional VMs

WSL did use Hyper-V hypervisor. This is not true anymore since the Linux kernel used by WSL was integrated directly into Windows. As a proof, I am running Ubuntu into WSL with all Hyper-V features disabled as well as the Docker Engine

10Dev commented 7 months ago

But you are simply not correct. If you scroll down the list you will notice that "Windows Hypervisor Platform" is on. That is the core of Hyper-V that Microsoft is propagating to standardize on all Windows Platforms. As soon as you install WSL 2, you are running a minimum of 2 VMs - One for a custom Linux kernel and the other for your Windows OS. Nobody notices that their Windows is now running in a VM because it runs as an "Enlightened Child Partition" and the special Linux kernel is also full of code to run "Enlightened" - so all the Hyper-V checkbox gets you is the ability to run plain old "Unenlightened" VMs which is why the Docker that runs a VM seems so much slower than the WSL 2 version. Since this is all Developer stuff having the ability to add a Hyper-V VM when you want with no extra footprint is useful to have enabled or at the worst, harmless. You are already running your Windows in a VM which is the big hit if you are going to see any impact!

hv_architecture

xolider commented 7 months ago

But you are simply not correct. If you scroll down the list you will notice that "Windows Hypervisor Platform" is on. That is the core of Hyper-V that Microsoft is propagating to standardize on all Windows Platforms. As soon as you install WSL 2, you are running a minimum of 2 VMs - One for a custom Linux kernel and the other for your Windows OS. Nobody notices that their Windows is now running in a VM because it runs as an "Enlightened Child Partition" and the special Linux kernel is also full of code to run "Enlightened" - so all the Hyper-V checkbox gets you is the ability to run plain old "Unenlightened" VMs which is why the Docker that runs a VM seems so much slower than the WSL 2 version. Since this is all Developer stuff having the ability to add a Hyper-V VM when you want with no extra footprint is useful to have enabled or at the worst, harmless. You are already running your Windows in a VM which is the big hit if you are going to see any impact!

hv_architecture

I agree your point. But my original question is about the full Hyper-V feature (and not WHP). Hyper-V management features are disabled because I don't need it, but the Docker upgrader does enable it whereas it is not needed when Docker Desktop is running over WSL2. For you to see which features I am talking about, please check the following picture hyper_v_feature_screenshot

10Dev commented 7 months ago

OK so that was my original point that your description was confusing because it implied you didn't want the Hyper-V infrastructure which is impossible.

With the notes we have added here it adds up to a better description but with the infrastructure changes that Microsoft has made, I don't think you will save much disk space with Hyper-V unchecked and since you are for sure running Hyper-V under the hood, unchecking also won't let you run other VMs

Also, because Docker is being updated and still has the option to run in a VM it isn't really a bug perhaps to default Hyper-V to ON. Also if you want to run Windows Containers and Linux Containers at the same time, Docker will install BOTH to a VM and WSL 2!

KoakiMiku commented 1 month ago

+1, same problem. I'm using WSL2 and don't need Hyper-V management and Windows Container features.