【发布时间】:2020-08-14 18:46:20
【问题描述】:
我有三个由在 Windows 上运行的 docker-compose 创建的服务,其中之一是基于 PHP:7.2-apache。 我能够使用 XDebug 在 PHPStorm 中调试正在运行的应用程序,但是由于我已经复制了这个 docker-compose,所以我不能了。
这是 XDEBUG_CONFIG 变量的值:
idekey=phpstorm remote_host=192.168.0.18 remote_log=/var/log/xdebug/xdebug.log remote_port=9000
remote_host 是主机的本地 IP 地址,您可以在 ipconfig 的结果中看到(对不起,它是法语):
Configuration IP de Windows
Carte Ethernet Ethernet :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::e5d8:3f1c:32b0:d0ea%13
Adresse IPv4. . . . . . . . . . . . . .: 192.168.0.18
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . : 192.168.0.1
Carte Ethernet vEthernet (Commutateur par) 2 :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::b1c1:deaf:a8cd:a9b7%3
Adresse IPv4. . . . . . . . . . . . . .: 172.31.145.129
Masque de sous-réseau. . . . . . . . . : 255.255.255.240
Passerelle par défaut. . . . . . . . . :
XDebug 记录这些消息:
[53] Log opened at 2020-04-30 11:45:11
[53] I: Connecting to configured address/port: 192.168.0.18:9000.
[53] E: Time-out connecting to client (Waited: 200 ms). :-(
[53] Log closed at 2020-04-30 11:45:11
在容器上执行route 命令会打印:
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
我不知道 XDebug 正常工作时默认网关是什么,但是现在这个值是主机默认网关是否正常?
我应该在我的 docker-compose 中配置网络吗?
感谢您的帮助!
【问题讨论】:
标签: windows docker networking docker-compose xdebug