title: Redis connection to 127.0.0.1:6379 failed using Docker
body: <p>Hi i'm using docker compose to handle all of my configuration.</p>
  
  <p>i have mongo, node, redis, and elastic stack.</p>
  
  <p>But i can't get my redis connect to my node app.</p>
  
  <p>Here is my <strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '2'
  services:
    mongo:
      image: mongo:3.6
      container_name: "backend-mongo"
      ports:
        - "27017:27017"
      volumes:
        - "./data/db:/data/db"
    redis:
      image: redis:4.0.7
      ports:
        - "6379:6379"
      user: redis
    adminmongo:
      container_name: "backend-adminmongo"
      image: "mrvautin/adminmongo"
      ports: 
        - "1234:1234"
    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.1.1
      container_name: "backend-elastic"
      environment:
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata1:/usr/share/elasticsearch/data
      ports:
        - 9200:9200
      networks:
        - esnet
    web:
      container_name: "backend-web"
      build: .
      ports:
       - "8888:8888"
      environment:
       - MONGODB_URI=mongodb://mongo:27017/backend
      restart: always
      depends_on: 
       - mongo
       - elasticsearch
       - redis
      volumes:
       - .:/backend
       - /backend/node_modules
  volumes:
    esdata1:
      driver: local
  networks:
    esnet:
  </code></pre>
  
  <p>Things to notice:</p>
  
  <ul>
  <li>The redis is already running ( I can ping the redis)</li>
  <li>I don't have any services running on my host only from the container</li>
  <li>Other containers (except redis) work well</li>
  <li>I've tried this method below</li>
  </ul>
  
  <p><code>const redisClient = redis.createClient({host: 'redis'});
   const redisClient = redis.createClient(6379, '127.0.0.1');
   const redisClient = redis.createClient(6379, 'redis');
  </code></p>
  
  <p>I'm using</p>
  
  <ul>
  <li>docker 17.12</li>
  <li>xubuntu 16.04</li>
  </ul>
  
  <p>How can i connect my app to my redis container?</p>