Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Support for xdebug within Docker container? #206

Open
romellem opened this issue Jan 24, 2017 · 3 comments
Open

Support for xdebug within Docker container? #206

romellem opened this issue Jan 24, 2017 · 3 comments

Comments

@romellem
Copy link

Does pugdebug support listening to xdebug from a Docker container?

Most of the "Docker + Xdebug" tutorials you find online target PhpStorm, so I'd think that in theory I should be able to get it functioning.

This guide - http://blog.arroyolabs.com/2016/10/docker-xdebug/ - seemed decent enough to go off of, but I haven't been able to get it to work with it.

Anyone else try to get something like that setup?

@robertbasic
Copy link
Owner

I do all of my work in Vagrant, so I haven't had the use case for this, but I'll try and bring up a basic docker image and try it out.

Thanks for bringing it up!

@kermorgant
Copy link

kermorgant commented May 17, 2017

For information, I get it working inside docker with the following configuration inside php.ini

       xdebug.idekey=pugdebug
       xdebug.remote_enable=1
       xdebug.remote_port=9000
       xdebug.remote_connect_back=1
       xdebug.remote_log=/tmp/php5-xdebug.log
       xdebug.remote_host=192.168.208.1 # host ip

host ip address has to be set manually. You can get it in the container with the following command

   /sbin/ip route|awk '/default/ { print $3 }'

I manage the php.ini file outside of the container, with the following mapping

services:
  php:
    image: kgtech/php7-dev
    volumes:
      - .:/var/www
      - ./docker/php.ini:/usr/local/etc/php/php.ini

@8ctopus
Copy link

8ctopus commented Apr 1, 2020

For those having problems enabling remote debugging from a docker container (like I had for about 5 hours), here's a config that works without changes:

xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.remote_autostart=0
xdebug.remote_connect_back=0

On the client side (host), use these settings:

host: 127.0.0.1
port: 9000

And make sure your docker-compose does not map port 9000:9000 at all as otherwise it won't work. Here's a docker example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants