title: GitLab Ci with docker runner - Multiple Stages
body: <p>im setting up my first GitLab Ci Pipeline including docker to run my project. I wanted to divide my pipeline into several stages so i created "build", "test", and "clean-build".</p>
  
  <p>In this scenario everything works fine:</p>
  
  <pre><code>stages:
    - build
    - test
    - clean
  
  image: docker:latest
  
  services:
    - docker:dind
  
  before_script:
    - export RELEASE=${CI_BUILD_REF_NAME}
    - docker version
  
  build:
    stage: build
    tags:
      - sendis-dind
    script:
    - echo "Hallo in Build Stage"
  
  test:
    stage: test
    tags:
      - sendis-dind
    script:
      - echo "Hallo in TEST Stage"
  
  clean-build:
    stage: clean
    tags:
      - sendis-dind
    script:
      - echo "Hallo beim Clean Up"
    when: always
  </code></pre>
  
  <p>All 3 stages are run successfully</p>
  
  <p>but this fails:</p>
  
  <pre><code>stages:
    - build
    - test
    - clean
  
  image: docker:latest
  
  services:
    - docker:dind
  
  before_script:
    - export RELEASE=${CI_BUILD_REF_NAME}
    - docker version
  
  build:
    stage: build
    tags:
      - sendis-dind
    script:
    - apk add --update py-pip
    - pip install docker-compose
    - docker --version
    - docker-compose --version
    - docker-compose -p ${RELEASE} build
    - docker-compose -p ${RELEASE} up -d
  
  test:
    stage: test
    tags:
      - sendis-dind
    script:
      - docker exec ${RELEASE}_phpfpm_1 bash -c "cd /app; composer install; make runTests"
  
  clean-build:
    stage: clean
    tags:
      - sendis-dind
    script:
      - docker-compose -p ${RELEASE} down --volumes
    when: always
  </code></pre>
  
  <p>with the following message from second stage</p>
  
  <pre><code>Running with gitlab-ci-multi-runner 9.1.1 (6104325)
    on sendis-dind-runner (8b9eca1e)
  Using Docker executor with image docker:latest ...
  Starting service docker:dind ...
  Pulling docker image docker:dind ...
  Using docker image docker:dind ID=sha256:559dd16b4e0a64d9de2447d3de234743046443f770bf5226f45f9b7f9c68887b for docker service...
  ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  Will be retried in 3s ...
  Using Docker executor with image docker:latest ...
  Starting service docker:dind ...
  Pulling docker image docker:dind ...
  Using docker image docker:dind ID=sha256:559dd16b4e0a64d9de2447d3de234743046443f770bf5226f45f9b7f9c68887b for docker service...
  ERROR: Preparation failed: Error response from daemon: Conflict. The container name "/runner-8b9eca1e-project-140-concurrent-0-docker" is already in use by container "db166f7894856c245c6a4f5318326c5f3b6ab82d82157961d18b079444153113". You have to remove (or rename) that container to be able to reuse that name.
  Will be retried in 3s ...
  Using Docker executor with image docker:latest ...
  Starting service docker:dind ...
  Pulling docker image docker:dind ...
  Using docker image docker:dind ID=sha256:559dd16b4e0a64d9de2447d3de234743046443f770bf5226f45f9b7f9c68887b for docker service...
  ERROR: Preparation failed: Error response from daemon: Conflict. The container name "/runner-8b9eca1e-project-140-concurrent-0-docker" is already in use by container "db166f7894856c245c6a4f5318326c5f3b6ab82d82157961d18b079444153113". You have to remove (or rename) that container to be able to reuse that name.
  Will be retried in 3s ...
  ERROR: Job failed (system failure): Error response from daemon: Conflict. The container name "/runner-8b9eca1e-project-140-concurrent-0-docker" is already in use by container "db166f7894856c245c6a4f5318326c5f3b6ab82d82157961d18b079444153113". You have to remove (or rename) that container to be able to reuse that name.
  </code></pre>