How to run compose in windows as in wsl without modification

volumes:
  - /disk1/db1:/var/lib/postgresql/data

If I run docker compose up -d from wsl, everything works.

But when I run from Windows - it tries to use /disk1/db1 as Windows path. But I need /disk1/db1 to be treated as wsl path in both cases.

I am afraid that what you want is not possible with how docker clients work, as /disk1/db1 is not a valid Windows path.

The syntax are different between your Windows host and a WSL Linux distribution.