Remote Debugging with XDebug from inside a Docker Container does not work Remote Debugging with XDebug from inside a Docker Container does not work docker docker

Remote Debugging with XDebug from inside a Docker Container does not work


You can try with this configuration. php-apache build provide two method to compile and enable module php.It's nicer to use docker-php-ext-enable xdebug to set correct file configuration.

FROM php:5.4-apache# Enable and configure xdebugRUN pecl install xdebugRUN docker-php-ext-enable xdebugRUN sed -i '1 a xdebug.remote_autostart=true' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniRUN sed -i '1 a xdebug.remote_mode=req' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniRUN sed -i '1 a xdebug.remote_handler=dbgp' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniRUN sed -i '1 a xdebug.remote_connect_back=1 ' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniRUN sed -i '1 a xdebug.remote_port=9000' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniRUN sed -i '1 a xdebug.remote_host=127.0.0.1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniRUN sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini


For me on a PHP, NGINX Docker environment using sublime, I got it to work with these settings:

xdebug.remote_enable = 1xdebug.remote_mode = reqxdebug.remote_port = 9001xdebug.remote_connect_back=0xdebug.remote_host=host.docker.internal

The one that took me forever to figure out was to set the remote_host to host.docker.internal.


close: xdebug.remote_connect_back=0add: xdebug.remote_host=192.168.0.102[your docker host/machine IP]