Docker - Hyper-V instead of WSL 2?

In learning how to use Docker on install I am being asked to install Docker and to make sure Hyper-V is active. The problem is that the Docker installer says to use WSL 2 instead of Hyper-V.

Are we going to use Hyper-V or are we going to use WSL 2? I thought the point was not to use VMs to reduce the requirements of processing and resource hoggery? Or am I wrong?

Hi,
Use WSL2. Hyper-V gonna be abandoned.

Cheers.

1 Like

What is it going to be replaced with?

WSL2 will replace Hyper-V.

A bit of info from MSDN


Source

So to rephrase. We used to need both Hyper-V and WSL. Then we could use WSL2 only. And Hyper-V is no more needed so they will abandon it to focus on WSL2.

About these matters…

Docker app takes up a lot of space on my disk even tough i erase all my docker images and volumes with : docker system prune --all command.

So, I’ve noticed this big chunk of memory is stored in C:\Users<user name>\AppData\Local\Docker\wsl\data into the file ext4.vhdx.
I firstly keep on trashing that file and start fresh again and again.
But, at some point, I’d like to keep docker images and volumes locally.

I’ve found out that you can optimize the management of that ext4.vhdx file by running this command on PowerShell PS C:> Optimize-VHD -Path C:\Users<user name>\AppData\Local\Docker\wsl\data\ext4.vhdx -Mode Full which is not working on my computer since it seems that Hyper-V is not disponible on my machine.
Reference : https://learn.microsoft.com/en-us/powershell/module/hyper-v/optimize-vhd?view=windowsserver2022-ps

Would you (UniqueNospaceShort) know how I can properly manage that without having to wipe everything ever since I want to diminish the size of memory usage?

Thanks in advances!
Happy coding!!!

Hi,

I never had to worry about disk space myself.
But a quick lookup and a bit of reading, I gathered a few interesting links.
It turns out you are not cleaning volumes by using docker system prune and that sounds like a descent and desirable behaviour. Moreover volumes are likely outside the disk space you want to free.

The doc

Some SO topic

You may use docker image prune -a that would be doing more than docker system prune (basically pruning images, containers and networks in one command but apparently not as deeply as each specific command).
Ultimately I invite you to read that article that seems to explain more in depth.

You talk about “a lot of space” but how much is “a lot” ?
It is simply using the space it has to for the assets you are actually using.

Cheers.

Premièrement merci!
J’imagine que tu parles français tout comme moi. Je suis du Québec!!!
Je n’ai pas encore lu , pour le moment, tes reccomendations mais je compte le faire suite à ce message.
Pour moi, je considère que 7Go se logeant dans le ext4.vhdx c’est beaucoup trop pour une seule image de 350 Mo…
Je continue mon investigation et encore merci!!! :grinning:

Je parle effectivement français. J’ai juste survolé le dernier article pour voir la teneur en général mais ça me semble intéressant pour comprendre votre problème. Aussi il est possible qu’il n’y ait plus grand chose à faire de plus que ce que vous avez déjà fait.

Vous verrez bien après avoir lu l’article.

Bonne chance.