xdebug 3.0 wsl2和vscode -docker -proxy已经在使用地址
我在WSL中的Vscode:Ubuntu无法收听Xdebug端口,因为它被某些Docker-Proxy挡住了。
我正在关注此解决方案收听Xdebug端口,会导致以下错误:
错误:听eaddrinuse:已使用的地址::: 9003
任何人可以帮助将VSCODE连接到Xdebug吗?
Windows 11说,该端口已经由WSLHOST分配:
PS C:\WINDOWS\system32> Get-Process -Id (Get-NetTCPConnection -LocalPort 9003).OwningProcess
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
285 47 2288 4748 0,05 19480 1 wslhost
它是由某些Docker-Proxy分配的:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9003 0.0.0.0:* LISTEN 17210/docker-proxy
tcp6 0 0 :::9003 :::* LISTEN 17217/docker-proxy
Docker-compose-version: Docker-Compose版本1.25.0 1.25.0
xdebug.log。
[Step Debug] INFO: Connecting to configured address/port: host.docker.internal:9003.
[Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) :-(
Ubuntu告诉, 只要什么都没听。
至于 xdebug.client_host
我尝试了:
vAr如此注释也不会删除错误。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了。对于其他面临挑战的人:
WSL -ubuntu的内部 - > docker-containter
host.docker.internal
将错误的IP引入。在WSL-Distribution中,文件
/etc/resolv.conf
是Windows主机的IP。要获取正确的IP使用此答案:如何获取Linux和OS X上本地计算机的主要IP地址?
可变性
我的解决方案是通过此IP定义 包装容器:
Solved it. For others with this challenge:
Inside of wsl-ubuntu -> docker-containter
host.docker.internal
directs to the wrong ip.In the wsl-distribution the file
/etc/resolv.conf
is the ip of the windows host.To get the correct ip use this answer: How to get the primary IP address of the local machine on Linux and OS X?
My solution is to define an env-variable with this ip:
and configure the container with it: