title: How to setup an variable ENV inside Dockerfile to be overriden in a Docker container?
body: <p>I have a container that should be created with the IP user.</p>
  
  <p>This is what i have inside the Dockerfile:</p>
  
  <pre><code>ENV REMOTE_HOST=xxxxxxxxxx
  
  RUN { \
          echo '[xdebug]'; \
          echo 'zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so'; \
          echo 'xdebug.remote_enable=1'; \
          echo 'xdebug.remote_port=9000'; \  
          echo 'xdebug.remote_autostart=1'; \
          echo 'xdebug.remote_handler=dbgp'; \
          echo 'xdebug.idekey=dockerdebug'; \
          echo 'xdebug.profiler_output_dir="/var/www/html"'; \
          echo 'xdebug.remote_connect_back=0'; \
          echo 'xdebug.remote_host=$REMOTE_HOST'; \
      } &gt;&gt; /usr/local/etc/php/php.ini
  </code></pre>
  
  <p>And this is how I create an container derived from that Dockerfile:
  dockerrun an image from that Dockerfile:</p>
  
  <pre><code>docker run -e REMOTE_HOST=123456   -p 80:80  -v /Users/myusrname/Documents/mysite:/var/www/html myImage
  </code></pre>
  
  <p>This is what I have in php.ini inside the container:</p>
  
  <pre><code>root@1713e0a338f9:/var/www/html# cat /usr/local/etc/php/php.ini
  ...
  [xdebug]
  zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
  xdebug.remote_enable=1
  xdebug.remote_port=9000
  xdebug.remote_autostart=1
  xdebug.remote_handler=dbgp
  xdebug.idekey=dockerdebug
  xdebug.profiler_output_dir="/var/www/html"
  xdebug.remote_connect_back=0
  xdebug.remote_host=$REMOTE_HOST
  </code></pre>
  
  <p>What is the correct way to pass that variable?</p>