Hello guys,
I need help with my docker php container and access to the host system.
I’m using the docker php-apache image (7.2) and would like to use the php extension “XDebug”, which i already installed successfully, and the VSCode extension PHP-Debug to debug my PHP code better.
XDebug send frequently debugging messages to the (remote) host system on a specified port.
I created a new bridged network to have a static host IP-address/ gateway that i already set in my php ini file.
The PHP-Debug extension in VSCode is already listening on the port 9001 to receive the debug informations that XDebug sends from the container.
The problem now is, that i can’t establish a TCP connection from inside the container to my host with a specified port.
I can however ping the host system successfully with the host IP-Address/ gateway i specified for the server, but the TCP connection always times out.
This also prevents XDebug from working, because it’s not able to send the debug information to the remote host.
So my question is how do I have to setup my docker-compose file, that (TCP) communication from inside the container to the host is possible?
I am also using a second (mysql) container in the same network which needs to be connected to my php container.
Just switching to network_mode : host
was not successful for me, because i lost the connection to and between the two containers.
I would be very thankful, if anyone has some tips for me.