title: PHP Xdebug Time-out connecting to client (Docker, VSCode, Ubuntu)
body: <p>I'm trying to troubleshoot a Docker/PHP-Xdebug/VSCode environment on Ubuntu that has been working very well for the last few months. And now xdebug have trouble connecting to the client.</p>
  
  <p>After entering the Docker with <code>docker exec --tty --interactive bw bash</code></p>
  
  <pre><code>php -v
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>PHP 7.2.14 (cli) (built: Feb  6 2019 05:10:24) ( NTS )
  Copyright (c) 1997-2018 The PHP Group
  Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
      with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
  </code></pre>
  
  <p>while <code>php -m -c</code> lists Xdebug in the [Zend Modules] section.</p>
  
  <p>Here is the .ini part</p>
  
  <pre><code>[xdebug]
  xdebug.default_enable = 1
  xdebug.remote_enable = 1
  xdebug.remote_autostart = 1
  xdebug.remote_connect_back = 1
  xdebug.idekey = VSCODE
  xdebug.remote_handler = "dbgp"
  xdebug.remote_port = 9000
  xdebug.remote_log=/var/log/apache2/xdebug.log
  xdebug.remote_timeout = 500
  </code></pre>
  
  <p>Eveything in there is reflected accordingly in <code>phpinfo()</code> output.</p>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: "3.1"
  services:
    webserver:
      build: docker/apache
      container_name: bw
      volumes:
        - .:/var/www/html
      ports:
       - "8000:80"
      expose:
       - "9000"
      restart: always
  </code></pre>
  
  <p>launch.json</p>
  
  <pre><code>{
      "version": "0.2.0",
      "configurations": [
          {
              "name": "Listen for XDebug",
              "type": "php",
              "request": "launch",
              "port": 9000,
              "log":true,
              "pathMappings": {
              "/var/www/html": "${workspaceRoot}/",
              }
          },
          {
              "name": "Launch currently open script",
              "type": "php",
              "request": "launch",
              "program": "${file}",
              "cwd": "${fileDirname}",
              "port": 9000
          }    ]
  }
  </code></pre>
  
  <p>This is the tail of the xdebug.log</p>
  
  <pre><code>[156] Log opened at 2019-08-05 19:39:58
  [156] I: Checking remote connect back address.
  [156] I: Checking header 'HTTP_X_FORWARDED_FOR'.
  [156] I: Checking header 'REMOTE_ADDR'.
  [156] I: Remote address found, connecting to 172.18.0.1:9000.
  [156] E: Time-out connecting to client (Waited: 500 ms). :-(
  [156] Log closed at 2019-08-05 19:39:59
  </code></pre>
  
  <p>I strongly suspect my lack of Docker knowledge is the problem to make this work again.</p>
  
  <p>Any help would be appreciated.</p>