lando / hyperdrive

Accelerate from zero to a Lando-based dev environment in less then 12 par-steps
https://lando.dev/hyperdrive
GNU General Public License v3.0
47 stars 13 forks source link

Access Linux Docker from Windows #36

Closed quentint closed 2 years ago

quentint commented 2 years ago

I recently moved one of my "Windows Lando" projects to the "Windows WSL Hyperdrive" setup and need to connect to this setup's Docker to use my PHPStorm PHPUnit recipe.

I'm stuck trying to setup Docker in PHPStorm.

Is WSL's Docker (installed by Hyperdrive) accessible from Windows?
Can you help me with that?

Thanks!

quentint commented 2 years ago

After digging a bit I realized I may just need to be able to access the *_appserver_1 container (should be enough to use the PHP CLI interpreter), and not necessarily Docker itself.

I tried with https://github.com/jeroenpeeters/docker-ssh but I currently face these issues when SSH'ing:

Still investigating...

quentint commented 2 years ago

Recently found a way to work this out 🎉
Here's a quick guide to do so.

Running PHPUnit tests in IntelliJ IDEA or PhpStorm

For this setup to work you have to:

  1. Have your IDE in Windows
  2. Have your project in Lando, in WSL
  3. Have Windows Docker Desktop with:
    1. General > Use the WSL 2 based engine
    2. Resources > WSL Integration > Enable integration with my default WSL distro (and maybe check other distros, then refresh)

Here are the IDE settings you need:

Warning: First test runs will fail with "Could not open input file: bin/phpunit", but subsequent should work just fine.