与网关的Docker容器连接被拒绝

在使用docker设置php dev环境时,我通过dbgp代理设置远程debugging(XDEBUG)时遇到了一个问题。

将主机连接到代理似乎没有问题,但代理容器无法通过configuration的端口(在本例中为9003)到达主机,

我正在使用docker撰写窗口

将我的开发机器成功连接到代理:

INFO: dbgp.proxy: Server:onConnect ('172.18.0.1', 36558) [proxyinit -p 9003 -k XDEBUG_IDEA -m 1 ] 

在执行包含正确IDE密钥的请求(例如http:// localhost /?XDEBUG_SESSION_START = XDEBUG_IDEA )时,代理会正确响应 ,但无法通过我的开发机器注册的端口联系网关)

 INFO: dbgp.proxy: connection from 172.18.0.2:40902 [<__main__.sessionProxy instance at 0x7fcff1998998>] ERROR: dbgp.proxy: Unable to connect to the server listener 172.18.0.1:9003 [<__main__.sessionProxy instance at 0x7fcff1998998>] Traceback (most recent call last): File "/usr/local/bin/pydbgpproxy", line 223, in startServer self._server.connect((self._serverAddr[0], self._serverAddr[1])) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 111] Connection refused WARNING: dbgp.proxy: Unable to connect to server with key [XDEBUG_IDEA], stopping request [<__main__.sessionProxy instance at 0x7fcff1998998>] INFO: dbgp.proxy: session stopped 

关于这里出了什么问题的任何想法? 防火墙的问题可以排除在这里,因为我基本上只是反过来。

我login到dbgpproxy容器,并能够通过端口80和8080发送请求到网关IP,但得到同样的连接拒绝时,尝试端口9003)

任何指针将不胜感激!

docker工作人员撰写文件:

 version: '2' volumes: mysqldata: driver: local services: app: restart: "always" image: php:7.0-fpm command: "true" volumes: - .:/var/www/html nginx: restart: "always" build: ./docker/nginx/ ports: - "80:80" depends_on: - php php: restart: "always" build: ./docker/php/ environment: XDEBUG_CONFIG: remote_host=dbgpproxy expose: - "9000" depends_on: - mysql volumes_from: - app composer: restart: "no" image: composer/composer:php7 command: install volumes: - .:/app dbgpproxy: restart: "always" image: christianbladescb/dbgpproxy expose: - "9000" ports: - "9001:9001" environment: DOCKER_HOST: 10.0.75.1 mysql: image: mysql:latest volumes: - mysqldata:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: secret MYSQL_DATABASE: project MYSQL_USER: project MYSQL_PASSWORD: project phpmyadmin: image: phpmyadmin/phpmyadmin ports: - 8080:80 depends_on: - mysql environment: PMA_HOST: mysql redis: image: redis ports: - "6379:6379" mailcatcher: image: schickling/mailcatcher restart: "always" 

Dockernetworking信息:

 [ { "Name": "test_default", "Id": "8f5b2e1188d65948d6a46977467b181e7fdb4b112a688ff87691b35c29da8970", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Containers": { "05725540eca07666de250f2bb9ae856da69c0c325c4476150f214ba32a9b8714": { "Name": "test_nginx_1", "EndpointID": "723a820ea07e77cf976712293a911be3245e862477af6e0ecdcc1462536de6f5", "MacAddress": "02:42:ac:12:00:08", "IPv4Address": "172.18.0.8/16", "IPv6Address": "" }, "78085ebed911e767a9c006d909cb245e0392055d37550c6cfa3a618969bef821": { "Name": "test_dbgpproxy_1", "EndpointID": "2332e1a01a8c0ec7262d96829d7d8f3cb4c711b6e9033ab85a8dfdb57ae01382", "MacAddress": "02:42:ac:12:00:0a", "IPv4Address": "172.18.0.10/16", "IPv6Address": "" }, "7e12ea0a3a9b90360be6c15222fd052fbf02065aa18b8a3b12d19779bef4b41b": { "Name": "test_phpmyadmin_1", "EndpointID": "456a6508b6a507e01584beaf54eec9605db449261749065a562a6fb62111bb9c", "MacAddress": "02:42:ac:12:00:05", "IPv4Address": "172.18.0.5/16", "IPv6Address": "" }, "81043a642cd9932e16bc51ba4604f6057d82e2c05f6e7378a85adfaa2de87f28": { "Name": "test_app_1", "EndpointID": "cfa41a5f210d4907747dcf7d516c6bdaecb817c993867a1e5f8e0250d33c927b", "MacAddress": "02:42:ac:12:00:03", "IPv4Address": "172.18.0.3/16", "IPv6Address": "" }, "8b0cd7dc33fb783ae811f7ba15decd0165199da66242a10a33d8ee86c41bd664": { "Name": "test_mailcatcher_1", "EndpointID": "f2ed38e42dffd9565822a7ac248dcb022a47c8a78b05e93793b62d7188d0823c", "MacAddress": "02:42:ac:12:00:06", "IPv4Address": "172.18.0.6/16", "IPv6Address": "" }, "d552bf1ab3914220b8fbf9961cc3801acbe180c6e945bd0b4c3bcf8588352a5d": { "Name": "test_mysql_1", "EndpointID": "6188cbeb49cf8afc2a7622bd6ef7fc7076ea91b909ec3efc1d9a1ed1d35d5790", "MacAddress": "02:42:ac:12:00:04", "IPv4Address": "172.18.0.4/16", "IPv6Address": "" }, "ecc941fc337d727e3c118bf9112dee1552ef5db7c94b24706c7d03bc42ea6c0a": { "Name": "test_redis_1", "EndpointID": "3f4254982ed1be8354f514dd717993e02b4afdfad8d022f5f8daf0b919a852e1", "MacAddress": "02:42:ac:12:00:07", "IPv4Address": "172.18.0.7/16", "IPv6Address": "" }, "f15f53405205db7263013fbb1ef1272764ca16850a46097b23d3619cd3d37b20": { "Name": "test_php_1", "EndpointID": "5fe30610823cd5660bf62e7612007ff4eef0316cbdfd15dbc0e56cafa6a3aca7", "MacAddress": "02:42:ac:12:00:02", "IPv4Address": "172.18.0.2/16", "IPv6Address": "" } }, "Options": {}, "Labels": {} } ]