title: Configure cache on GitLab runner
body: <p>I don't manage to configure a cache directory, but somehow it does not work. I'm not even sure it takes the config.toml file.</p>
  
  <p>my config.toml:</p>
  
  <pre><code>concurrent = 1
  check_interval = 0
  
  [session_server]
    session_timeout = 1800
  
  [[runners]]
    cache_dir = /tmp/gitlab-runner-cache
  </code></pre>
  
  <p>... both on /etc/gitlab-runner/config.toml and in ~/.gitlab-runner/config.toml</p>
  
  <p>my .gitlab-ci.yml:</p>
  
  <pre><code>image: docker:latest
  services:
    - docker:dind
  
  cache:
    key: "myCache"
    paths:
      - ${CI_PROJECT_DIR]/.m2/
  
  variables:
    DOCKER_DRIVER: overlay
    MAVEN_OPTS: -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2
  
  stages:
    - build
    - acceptance
  
  maven-build:
    image: maven:3.3-jdk-8
    stage: build
    script: "mvn clean package"
    artifacts:
      paths:
        - target/*.jar
  
  maven-acceptance:
    dependencies:
      - maven-build
    image: maven:3.3-jdk-8
    stage: acceptance
    script: "mvn verify"
  </code></pre>
  
  <p>When I try:
     gitlab-runner exec shell maven-build </p>
  
  <p>I get the error:</p>
  
  <pre><code>ERROR: Could not create cache adapter               error=cache factory not found: factory for cache adapter "" was not registered
  </code></pre>
  
  <p>The build is successful, but the .m2 repository is not cached...</p>
  
  <p>Therefore, I have 2 questions:</p>
  
  <ol>
  <li>How to know if gitlab-runner actually takes my config.yml?</li>
  <li>What is a correct config for caching?</li>
  </ol>
  
  <p>Thanks in advance!</p>