Effectively running docker images with volume mounts on Windows 10 (Pro)/ Windows 11 with WSL2

There is one trick:

When sharing volumes into your docker containers either via docker compose or docker run -v you need to make sure that not running them under a windows context, but:

a) use WSL2 (here Ubuntu 20.04 as an example)
b) copy your shared volume into the WSL context e.g. using the Windows Explorer with the address \\wsl$ -> then selecting the container “Ubuntu-20.04” and finding there a suitable location to deposit the files
c) run the docker run or docker compose from the WSL Shell e.g. from Windows terminal referring to that volume in the WSL2 virutal drive

Observed performance is about 10-15 times faster!

The Journey of Data GmbH
Herzog-Wilhelm-Str. 25
80331 München / Munich, Germany

(c) Copyright 2021