title: Can't connect PhpStorm with xdebug with Docker
body: <p>I have the following Dockerfile:</p>
  
  <pre><code> FROM php:7.0-fpm-alpine
  
  RUN  apk add --update --virtual build_deps gcc g++ autoconf make &amp;&amp;\
    docker-php-source extract &amp;&amp;\
    pecl install xdebug &amp;&amp;\
    echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
    &amp;&amp; echo "xdebug.remote_enable=1" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
    &amp;&amp; echo "xdebug.remote_autostart=0" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    echo "xdebug.remote_connect_back=1" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    echo "xdebug.remote_handler = dbgp" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    echo "xdebug.remote_mode = req" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    docker-php-ext-enable xdebug &amp;&amp;\
    docker-php-source delete &amp;&amp; \
    apk del build_deps &amp;&amp; \
    rm -rf /var/cache/apk/* &amp;&amp; \
    rm -rf /tmp/*
  
  ENTRYPOINT ["php-fpm"]
  </code></pre>
  
  <p>And I run it with the following <code>docker-compose.yml</code>:</p>
  
  <pre><code>version: '2'
  services:
    nginx_dev:
      image: nginx:alpine
      ports:
        - "5092:5092"
      links:
        - "my_symfony_www_dev"
      volumes:
        - './conf/nginx/nginx_dev.conf:/etc/nginx/nginx.conf:ro'
        - './logs/dev:/var/logs'
      volumes_from:
        - 'my_symfony_www_dev'
  
      my_symfony_www_dev:
        build:
          context: .
          dockerfile: Dockerfile_dev
        image: "myimage/my_symfony_app:dev_php"  
        volumes:
          - "$SOURCE_PATH:/var/www/html:Z"
        environment:
          - PHP_IDE_CONFIG= "serverName=my_symfony_www_dev"
          - XDEBUG_CONFIG="remote_host=10.254.254.254,remote_port=9080"
          - PHP_XDEBUG_ENABLED=1
  </code></pre>
  
  <p>Also as seen <a href="https://stackoverflow.com/questions/46263043/how-to-setup-docker-phpstorm-xdebug-on-ubuntu-16-04">there</a> I run:</p>
  
  <pre><code>sudo ip addr add 10.254.254.254/24 brd + dev enp4s0 label enp4s0:1
  </code></pre>
  
  <p>And configured the PhpStorm IDE like that:</p>
  
  <p><a href="https://i.stack.imgur.com/hcnW7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hcnW7.png" alt="Remote Debugger PhpStorm settings"></a></p>
  
  <p><a href="https://i.stack.imgur.com/uDYl7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uDYl7.png" alt="Server"></a></p>
  
  <p><a href="https://i.stack.imgur.com/bvHFQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bvHFQ.png" alt="Xdebug Config"></a></p>
  
  <p><a href="https://i.stack.imgur.com/g1oQE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g1oQE.png" alt="DBGp Proxy config"></a></p>
  
  <p>Then in Firefox I press the <a href="https://i.stack.imgur.com/Vgxlp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vgxlp.png" alt="enter image description here"></a> button and in PhpStorm I press the <a href="https://i.stack.imgur.com/fuX2Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fuX2Y.png" alt="enter image description here"></a> button I set a breakpoint over the <code>app_dev.php</code> and nothing happens.</p>
  
  <p>My system listens over the port <code>9080</code> via <code>netstat -ntlp</code> command where the PhpStorm listens to (PhpStorm is a server according to <a href="https://stackoverflow.com/a/8049991/4706711">that answer</a>).</p>
  
  <pre><code>tcp        0      0 0.0.0.0:9080            0.0.0.0:*               LISTEN      4773/java       
  </code></pre>
  
  <p>Do you have any idea on why that happens and how to fix it?</p>
  
  <h1>Edit 1:</h1>
  
  <p>The <code>phpinfo()</code> shows:</p>
  
  <p><a href="https://i.stack.imgur.com/un18l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/un18l.png" alt="xdebug phpinfo"></a></p>
  
  <p>I've also set de cocker-compose.yml as: </p>
  
  <pre><code>version: '2'
  services:
    nginx_dev:
      image: nginx:alpine
      ports:
        - "5092:5092"
      links:
        - "my_symfony_www_dev"
      volumes:
        - './conf/nginx/nginx_dev.conf:/etc/nginx/nginx.conf:ro'
        - './logs/dev:/var/logs'
      volumes_from:
        - 'my_symfony_www_dev'
  
      my_symfony_www_dev:
        build:
          context: .
          dockerfile: Dockerfile_dev
        image: "myimage/my_symfony_app:dev_php"  
        volumes:
          - "$SOURCE_PATH:/var/www/html:Z"
        environment:
          - XDEBUG_CONFIG="remote_host=10.254.254.254,remote_port=9080"
          - PHP_XDEBUG_ENABLED=1
  </code></pre>
  
  <p>And my dockerfile is:</p>
  
  <pre><code>FROM php:7.0-fpm-alpine
  
  RUN  apk add --update --virtual build_deps gcc g++ autoconf make &amp;&amp;\
    docker-php-source extract &amp;&amp;\
    pecl install xdebug &amp;&amp;\
    echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
    &amp;&amp; echo "xdebug.remote_enable=1" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
    &amp;&amp; echo "xdebug.remote_autostart=0" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    echo "xdebug.remote_connect_back=0" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    echo "xdebug.remote_handler = dbgp" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    echo "xdebug.remote_mode = req" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini &amp;&amp;\
    docker-php-ext-enable xdebug &amp;&amp;\
    docker-php-source delete &amp;&amp; \
    apk del build_deps &amp;&amp; \
    rm -rf /var/cache/apk/* &amp;&amp; \
    rm -rf /tmp/*
  
  ENTRYPOINT ["php-fpm"]
  </code></pre>
  
  <p>Still Same result.</p>