连接到远程 Docker 镜像上的 XDEBUG

问题描述

我正在尝试使用 NetBeans 11 作为我的客户端进行调试,Docker 映像上的 Xdebug 3。 Docker 容器位于远程主机上。我无法建立连接。 NetBeans 屏幕底部的指示器将永远滚动并显示“等待连接 (netbeans-xdebug)”。我不确定我做错了什么。我过去在没有 Docker 和 Xdebug 2 的情况下做过这项工作,我不确定我是否搞砸了 Xdebug 3、Docker 或两者。

我的配置:

Dockerfile 正确添加了 Xdebug,我可以在我的容器中看到它。

docker-compose.yml

---

services:
  drupal:
    container_name: intranet-finkenb2
    ports:
      - "8082:80"
      - "9092:9003"
    volumes:
      - /home/finkenb2/intranet/custom_themes:/opt/drupal/web/themes/custom
      - /home/finkenb2/intranet/custom_modules:/opt/drupal/web/modules/custom
    environment:
      XDEBUG_MODE: debug,develop
      XDEBUG_SESSION: netbeans-xdebug
      XDEBUG_CONFIG: >
        client_host = localhost
        client_port = 9003
        discover_client_host=true
        start_with_request=yes
  db:
    container_name: intranet-finkenb2-db
  solr:
    container_name: intranet-finkenb2-solr
    ports:
      - "8982:8983"

volumes:
  public_files:
  private_files:
  site_settings:

通过 PuTTY 的 SSH 隧道:R9092 localhost:9092

NetBeans PHP 调试配置:

 - Debugger Port: 9092
 - Session ID: netbeans-xdebug
 - Maximum Data Length: 8192
 - Check: Stop at first line

NetBeans 项目配置(运行配置):

 - Run As: Remote Web Site
 - Project URL: http://intranet-finkenb2.devel.lib.msu.edu
 - index file: index.php
 - remote connection
   - hostname intranet8.devel.lib.msu.edu /*docker host server*/
   - user/pwd correct
   - initial directory /var/www/

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)