How to create/add/view EXT4-formatted disk for a container

I’m running a container from Docker Desktop/Windows with its internal utility that can only write data to a Linux filesystem (I presume this means EXT4-formatted disk) with the intent to then consume offline later from Windows tooling. Ideally this is a logical drive (rather than a physical HDD). I’ve tried the following approaches:

  1. Create a Windows .vhdx then use a 3rd party tool such as AOMEI Partition Assistant to format as EXT4 & mount (to Windows) as its D: drive - which works but Windows Disk Management sees the drive as RAW. Unfortunately when I try to mount this to the container, Docker complains with

docker: Error response from daemon: CreateFile D:: The volume does not contain a recognized file system.
Please make sure that all required file system drivers are loaded and that the volume is not corrupted.

Even if I can mount this drive, I still have the problem that I’m not sure how I can then read it later from Windows.

  1. My second approach was to create a volume using Docker Desktop and mount to the container. I’ve not had the chance to see whether the container’s utility can write to this location. At least I can see its content using Windows Explorer at its location \wsl.localhost\docker-desktop-data\data\docker\volumes

I’d like to understand what filesystem is used for this volume ? Can I force it to use EXT4, for example ?

Is there a better way to accomplish this ?

Thanks in advance

It should be already ext4.

You can test it yourself:
docker run --rm -v yourvolume:/mnt/test alpine df -T

Look at the line where “Mounted on” (last column) is /mnt/test and check the type column.

Many thanks for this approach. Indeed the Docker Desktop volume is EXT4.