0

I am trying to use Colima to run an apache-php docker container. My uni provides docker images derived from upstream ones configured for our course using docker-compose.

The container works as it should but I can't get its Xdebug to connect to my PhpStorm.

This is what it says in the Xdebug log:

Creating socket for 'host.docker.internal:9003', poll success, but error: Operation now in progress (29).

This tells me absolutely nothing.

The setup is admittedly quite complex (x86 Apache ran via QEMU in Docker in Linux VM in macOS on ARM CPU) but I can do nc host.docker.internal 9003 from any docker container, so I have no idea why Xdebug isn't able to reach my host. (Only works when the IDE is running and on no other ports, so it's definitely connecting to PhpStorm.)

Any idea what could be going on here?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Atemu
  • 295
  • 3
  • 12

3 Answers3

2

On Colina, the IP address is hard coded to "192.168.5.2", so setting xdebug.client_host=192.168.5.2 should do the trick. There is now also an alias for it, called host.lima.internal. As per this documentation page.

Derick
  • 35,169
  • 5
  • 76
  • 99
  • Not an option when working with others that don't use colima. – Atemu May 10 '22 at 05:48
  • The thing is that `host.docker.internal` works in regular containers but not when the `extra_hosts` config is used. – Atemu May 10 '22 at 05:48
0

The problem is the uni's docker-compose.yml which configured the container with:

    extra_hosts:
      - "host.docker.internal:host-gateway"

and apparently that can break host.docker.internal in some situations: https://github.com/docker/for-linux/issues/264#issuecomment-759737542

The solution is to remove those two lines.

Atemu
  • 295
  • 3
  • 12
0

Set:

xdebug.client_host=host.lima.internal instead xdebug.client_host=host.docker.internal

AND

xdebug.discover_client_host=0 instead xdebug.discover_client_host=1

in your php.ini config

Marcaum54
  • 623
  • 1
  • 6
  • 12