Configure xdebug in docker to use with netbeans

In the shell of your docker container run

1
pecl install xdebug && docker-php-ext-enable xdebug

This will install and enable xdebug. Now in your loaded php.ini file add following lines

1
2
3
4
5
6
7
8
9
xdebug.default_enable=1                                                                                                                     
xdebug.force_display_errors=1                                                                                                               
xdebug.remote_enable=1                                                                                                                      
xdebug.remote_handler=dbgp                                                                                                                  
xdebug.remote_autostart=1                                                                                                                   
xdebug.remote_connect_back=0                                                                                                                
xdebug.mode=debug                                                                                                                           
xdebug.idekey=netbeans-xdebug                                                                                                               
xdebug.remote_host=127.0.0.1

In your netbeans, under Tools -> Options -> PHP -> Debug, add the entries as shown in following image

Then open your project, add a break point and run debugger. Netbeans should be connected with xdebug