title: How to get the host ip dynamically in a docker-compose file?
body: <p>For a docker development environment we are using a docker-compose-file. Everything works fine and we are really happy, but there is one tiny issue i would to get working:</p>
  
  <p>We install php-fpm with xdebug. Now we configure it as follows:</p>
  
  <p><em>PHP-Dockerfile:</em></p>
  
  <pre><code>FROM php:7.1-fpm
  
  RUN docker-php-ext-install pdo_mysql \
  &amp;&amp; docker-php-ext-install json \
  &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=on" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo "xdebug.remote_autostart=off" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini
  </code></pre>
  
  <p><em>docker-compose.yml:</em></p>
  
  <pre><code>services:
    //[...]
    php:
      build: ./docker/php/
      container_name: dev-php
      expose:
        - 9000
      volumes:
        - .:/var/www/html
      environment:
        XDEBUG_CONFIG: remote_host=192.168.0.50
        PHP_IDE_CONFIG: "serverName=docker"
  </code></pre>
  
  <p>This setup works fine: we are able to debug with xdebug in the IDE on the local system. The only problem is, that we save one IP "192.168.0.50" static in the docker-compose-file. So each employee hast to change it to his own IP before running...</p>
  
  <p><strong>Now the question:</strong>
  is there a smarter way to get the hosts IP-address dynamically when building?</p>