title: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
body: <p>I'm trying to allow communication between my nodeJs docker image with my redis docker image (Mac OS X environment):</p>
  
  <p>nodeJs Dockerfile:</p>
  
  <pre><code>FROM node:4.7.0-slim
  EXPOSE 8100
  COPY . /nodeExpressDB
  CMD ["node", "nodeExpressDB/bin/www"]
  </code></pre>
  
  <p>redis Dockerfile:</p>
  
  <pre><code>FROM ubuntu:14.04.3
  EXPOSE 6379
  RUN apt-get update &amp;&amp; apt-get install -y redis-server
  </code></pre>
  
  <p>nodeJs code which is trying to connect to redis is:</p>
  
  <pre><code>var redis = require('redis');
  var client = redis.createClient();
  </code></pre>
  
  <p>docker build steps:</p>
  
  <pre><code>docker build -t redis-docker .
  docker build -t node-docker .
  </code></pre>
  
  <p>docker run images steps flow: </p>
  
  <pre><code>docker run -p 6379:6379 redis-docker
  docker run -p 8100:8100 node-docker
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code>Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
      at Object.exports._errnoException (util.js:907:11)
      at exports._exceptionWithHostPort (util.js:930:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1078:14)
  </code></pre>
  
  <p>What should I do inorder to connect to Redis from node-docker?</p>