Hi,
I’ve been using the HyperV backend on Docker Desktop for a while now because I saw better performance than from wsl2 when I tested running and debugging a Laravel app using it.
I found that acceptable until I moved Laravel to use Vite to build and develop. Vite take can 3 minutes to start inside my containers, so I figured it was time to try working using docker ‘best practices’ to see if that sped things up.
As I understand it, best practice is to keep your source code inside Linux, and not on the host (Windows) OS (where mine currently resides). And make those Linux code files available to your containers.
So I’ve moved my code inside ~/source/ on my default Ubuntu20.04 wsl2 distro. As I think that’s the best place to keep it.
My issue is what’s the best way to make that code available to my docker containers?
Currently in my docker compose file (that I run from Windows) I have a volume defined like this:
volumes:
- '\\wsl.localhost\Ubuntu-20.04\home\wsl_root\source\:/var/www/'
Is this best practice or not?
Will I get the best file system performance doing this? OR should I be changing my working methods to actually run docker compose from within my default linux Distro? Not from windows? And mounting the volume like this?
volumes:
- ~/source:/var/www/'
I’ve read the docs and this doesn’t entirely make sense.
Dave