Open RafaelKr opened 2 years ago
The host.docker.internal
hostname is not available on linux by default but can be added as extra_host:
extra_hosts:
- "host.docker.internal:host-gateway"
Together with XDEBUG_CLIENT_HOST: host.docker.internal
this configuration should work on macOS as well as linux.
Very interesting. You're right that host.docker.internal
can't be resolved inside the container but still debugging works inside my IntelliJ.
I created a public/info.php
and have set a debug breakpoint on the phpinfo();
line which works. The Info page tells me xdebug.client_host
is set to host.docker.internal
.
Please describe the feature you would like to see implemented.
I just tried to setup debugging with IntelliJ IDEA on a MacBook. For this I set the following in
.psh.yaml.override
:Now we have a container which comes preconfigured with Xdebug. This is already enough on my Linux machine to make it work.
For macOS it was also required to set an additional environment variable for the app_server container:
https://github.com/shopware/development/blob/53a182fc5f82f7b892dce1c22c7289a2ce66acd9/docker-compose.yml#L6-L18
Actually it's a very few changes to do this but I spent a lot of time to make this work, especially the
XDEBUG_CLIENT_HOST
took me long to find out.I think there should be a way to do this more easily, maybe add
XDEBUG_CLIENT_HOST: host.docker.internal
by default? I just made sure it works also on Linux. Or at least there should be some documentation about it how to make this work.