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?
2
Answers
The problem is the uni's
docker-compose.yml
which configured the container with:and apparently that can break
host.docker.internal
in some situations: https://github.com/docker/for-linux/issues/264#issuecomment-759737542The solution is to remove those two lines.
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, calledhost.lima.internal
.As per this documentation page.