Docker Community Forums

Share and learn in the Docker community.

IP address for xdebug

Using: Netbeans 8.2, Docker Toolbox on Mac, PHP7.2
Here’s how it worked for me after three hours of trying various ideas above:

On Mac host, run sudo ifconfig lo0 alias 10.254.254.254

In php.ini (in my case, xdebug.ini inside conf.d), use:

xdebug.remote_host=10.254.254.254
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.default_enable=0
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.idekey=netbeans-xdebug (or PHPSTORM, or whatever – just needs to match in IDE setup)

In the project run configuration, I use a "Local Web Site (running on local web server) that points to the URL I have in my hosts file that points to 192.168.99.100 (docker container IP).

The advanced settings (path mapping and debugger proxy) got me sidetracked for a while. I didn’t need these as a local docker container isn’t truly a remote server.

Good luck. Time for another sip of Monster.

Hello there,

You no longer need to setup a lo0 alias, the nice host.docker.internal is working like a charm on docker for mac.

Try following configuration:
xdebug.remote_autostart=1
xdebug.default_enable=0
xdebug.remote_enable=1
xdebug.remote_connect_back = 0
xdebug.remote_host = host.docker.internal
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

3 Likes

The fastcgi_param REMOTE_ADDR was the missing piece for me. Set both it and xdebug.remote_host to my host machines eth0 address and viola! xdebug breakpoints are working in vscode! - Thanks for the insight @raeesiqbal