title: Separate Xdebug from php-fpm and nginx containers
body: <p>I wanted to separate all my development tools from the main php-fpm and nginx containers. So I have basically 3 containers named as <strong>php-fpm</strong> runs on port 9000, <strong>nginx</strong> on port 80 and <strong>dev-tools</strong>. I have installed xdebug, composer etc on my dev-tools container but I am confused how to configure xdebug so that it will work with php-fpm container and can debug my website ? Second question does xdebug need php-cli or php-fpm to run itself? </p>
  
  <p><strong>#dev-tools</strong></p>
  
  <pre><code>FROM php:7.2-cli-alpine
  
  # Install the PHP extensions we need
  RUN set -ex \
      &amp;&amp; curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin -- --filename=composer.phar \
      &amp;&amp; apk add --no-cache git \
      &amp;&amp; pecl install xdebug \
      &amp;&amp; docker-php-ext-enable xdebug
  </code></pre>