【问题标题】:Xdebug Docker Cross Container Communication setupXdebug Docker 跨容器通信设置
【发布时间】:2019-06-21 23:23:12
【问题描述】:

我遇到了多个容器/跨容器 Xdebug PhpStorm 通信的问题。

我有一个包含 10 个容器的设置,它们相互通信,但似乎无法让 Xdebug 在所有容器上运行。

例如: 容器 A 向容器 B 发出请求,容器 B 向容器 C 发出请求。 如何让断点在 Container B 和 C 处停止?

目前我超时,没有 Xdebug 他们可以毫无问题地通信。

作为旁注,跨容器通信正在工作,它们在同一个网络中,Xdebug 在每个容器上独立工作。

这是我所有容器中的 Xdebug 配置:

xdebug.remote_port=9006
xdebug.remote_autostart=1
xdebug.remote_enable=1  
xdebug.remote_connect_back=0 
xdebug.remote_host=10.254.254.254 
xdebug.idekey=PHPSTORM

【问题讨论】:

    标签: php docker debugging containers xdebug


    【解决方案1】:

    找到解决办法,

    在进一步挖掘了一些相关的 github 问题后,我发现了这个线程: https://github.com/docksal/docksal/issues/389 这个stackoverflow问题: Docker / Xdebug Over LAN Server Multiple Developers

    这让我尝试了这个工作配置:

    所有容器中的最终配置现在是:

    xdebug.remote_port=[PORT]
    xdebug.remote_autostart=1
    xdebug.remote_enable=1  
    xdebug.remote_connect_back=0 
    xdebug.remote_host=10.254.254.254 
    xdebug.idekey=PHPSTORM
    

    提示:每个容器必须有不同的端口!

    例如

    1. 服务 1 = 9006
    2. 服务 2 = 9007
    3. 服务 3 = 9008

    等等

    基本上使用dockers内部网络并使用远程连接解决了它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-01
      • 2018-10-17
      • 1970-01-01
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多