lagoon: Xdebug host is not discovered correctly

Describe the bug When XDEBUG_ENABLE: "true" is specified, the xdebug. remote_host is always set to 172.22.0.1.

Running the command from https://github.com/amazeeio/lagoon/blob/master/images/php/fpm/entrypoints/60-php-xdebug.sh#L6 after container started returns correct results.

It looks like the timeout is too low to get this command running correctly during container starting.

To Reproduce Steps to reproduce the behavior on MacOS:

  1. Set XDEBUG_ENABLE: "true" in docker-compose.yml.
  2. docker-compose up -d --build
  3. Create a page with phpinfo() and run it.
  4. Check the value of xdebug.remote_host. It will be 172.22.0.1.

Expected behavior The value of xdebug.remote_host should be docker.for.mac.localhost.

It is possible to override this by setting DOCKERHOST: "docker.for.mac.localhost" in docker-compose.yml, but this defeats the purpose of the auto-discovery mechanism in https://github.com/amazeeio/lagoon/blob/master/images/php/fpm/entrypoints/60-php-xdebug.sh.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (12 by maintainers)

Most upvoted comments

I’ve got a commit ready to support the changes @Schnitzel has raised.

Just wanted to note, host.docker.internal should be supported on linux soon too via https://github.com/moby/moby/pull/40007

Setting DOCKERHOST: host.docker.internal works for me.