title: Using redis with Gitlab CI
body: <p>I am currently using serverless framework and setting up gitlab ci using shared runner.</p>
  
  <p>Following is my gitlab-ci.yml:</p>
  
  <pre><code>image: node:latest
  
  services:
    - redis
  
  cache:
    paths:
      - node_modules/
      - java/
  
  stages:
    - build
    - test
    - review
    - staging
    - production
  
  build:
    stage: build
    script:
        - npm install
    artifacts:
      paths:
        - node_modules/
  
  install:java:
    stage: build
    script:
        - apt-get update
        - apt-get install -y default-jre default-jdk openjdk-7-jre openjdk-7-jdk
        - apt-get update
        - sls dynamodb install
    artifacts:
      paths:
        - java/
  
  connect:
    image: redis
    script:
    - redis-cli -h redis PING
  
  unit test:
    stage: test
    script:
      - sls dynamodb start
      - babel-node ./aws/createDB.js
      - npm run unit
    dependencies:
      - build
      - install:java
  </code></pre>
  
  <p>unit test job requires redis and is not able to connect. Following error gets thrown, when unit test job starts: </p>
  
  <blockquote>
    <p>Error while creating redis client: Error: Redis connection to
    127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379</p>
  </blockquote>
  
  <p>Can someone point out what's wrong with current config file, thanks!</p>