Docker - 端口阻止侦听 [英] Docker - port prevents listening
问题描述
- 我正在使用Docker for Mac 1.12.0-rc2 -beta17与本机码头机器
-
我有一个容器,安装了xdebug,暴露9000端口并将其映射到端口9000:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6950c2a2b05d应用/ usr / bin / supervisord9分钟前上9分钟0.0.0.0:80->80/tcp,0.0.0.0:443->443/tcp,0.0.0.0:9000->9000/tcp,0.0.0.0:2222->22/tcp app_1
-
当我尝试使用PhpStorm监听端口9000进行调试连接时,我收到一个错误无法听到:端口9000正忙。
我必须确定我是网络中的新手。
它依赖于你想通过Xdebug连接
xdebug.remote_connect_back = 1
表示,PHP将等待直到具有GET参数 XDEBUG_SESSION_START =< IDE_key>
的HTTP请求。然后,服务器内的PHP将尝试通过您的PHPStorm列出的端口9000连接。经典不要打电话给我们,我们会打电话给你的情况。
现在你与Docker的情况很简单,你的容器负责9000端口,所以PHP会得到一个环回而PHPStorm无法使用端口9000,因为它已被您的docker容器使用。
所以跳过端口9000到docker的分配,这将修复这种情况。
I am trying to setup xdebug integration on my docker-based setup.
- I am using Docker for Mac 1.12.0-rc2-beta17 with the "native" docker machine
I have a container, with xdebug installed, exposing port 9000 and mapping it to the port 9000:
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6950c2a2b05d app "/usr/bin/supervisord" 9 minutes ago Up 9 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:9000->9000/tcp, 0.0.0.0:2222->22/tcp app_1
When I'm trying to use PhpStorm to listen to the port 9000 for debug connections, I'm getting an error "Cannot listen: port 9000 is busy".
I must precise that I'm a newbie in networks..
It dependent how you want to connect via Xdebug
xdebug.remote_connect_back=1
said that PHP will wait until a HTTP request with GET parameter XDEBUG_SESSION_START=<IDE_key>
. Then will PHP within the server try to connect back via port 9000 where your PHPStorm is listing. Classic don't call us, we will call you situation.
Now your situation with docker say simple, your container is responsible for port 9000. So PHP will get a loopback and PHPStorm isn't able to use port 9000 because its already used by your docker container.
So skip the assignment of port 9000 to docker, that will fix this situation.
这篇关于Docker - 端口阻止侦听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!