Mounting physical drive in docker-destop vm

Hi!

I am using Windows 11 and Docker Desktop 4.1.1 (69879).
I have mounted a physical drive in wsl2 and partitioned and formatted as ext4.
I could mount it in Ubuntu-20.04 my default wsl2 machine.

I would like to use this ext4 filesystem to mount in a Docker container that I start from Windows 11 command prompt. But how can I (temporary or permanently) mount this partition under the docker-desktop or docker-desktop-data vm?

The reason I am trying to do this is to be able to achive more performance from my Oracle 19 Docker container. Currently the Oracle data file are placed on a Windows NTFS paratition. I do not want to copy these files to Docker virtual filesystem, because these are over 200GB and I do not want my image to grow.

What I did:
Windows 11:
wsl --mount \.\PHYSICALDRIVE1
(this made my non system SSD available for all my 3 wsl2 vms)
Ubuntu:
parted /dev/sdc
mkfs.ext4 /dev/sdc1
e2label /dev/sdc1 disk-c-part1
mkdir /mnt/disk-c-part1
mount /dev/sdc1 /mnt/disk-c-part1

So after this the physical disk is acessible from Ubuntu-20.04 az /mnt/disk-c-part1 but not from docker-desktop or docker-desktop-data.

Best regards,

Gábor

I have solved the problem. WSL uses automount, so you should not mount the whole drive but only the partition you want to use in Docker.
e.g.: wsl --mount \.\PHYSICALDRIVE1 --partition 1
After this the partition of the physical drive could be accessed at the (default) automount point /mnt/wsl.
for example: /mnt/wsl/PHYSICALDRIVE1p1

Regards,
Gábor

1 Like