title: Deploy docker container using gitlab ci docker-in-docker setup
body: <p>I'm currently trying to setup a gitlab ci pipeline. I've chosen to <a href="https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-executor" rel="nofollow noreferrer">go with the Docker-in-Docker setup</a>.
  I got my ci pipeline to build and push the docker image to the registry of gitlab but I cannot seem deploy it using the following configuration:</p>
  
  <p><code>.gitlab-ci.yml</code></p>
  
  <pre><code>image: docker:stable
  services:
  - docker:dind
  
  stages:
  - build
  - deploy
  
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_DRIVER: overlay2
    TEST_IMAGE: registry.gitlab.com/user/repo.nl:$CI_COMMIT_REF_SLUG
    RELEASE_IMAGE: registry.gitlab.com/user/repo.nl:release
  
  before_script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  - docker info
  
  build:
    stage: build
    tags:
    - build
    script:
    - docker build --pull -t $TEST_IMAGE .
    - docker push $TEST_IMAGE
    only:
    - branches
  
  deploy:
    stage: deploy
    tags:
    - deploy
    script:
    - docker pull $TEST_IMAGE
    - docker tag $TEST_IMAGE $RELEASE_IMAGE
    - docker push $RELEASE_IMAGE
    - docker run -d --name "review-$CI_COMMIT_REF_SLUG" -p "80:80" $RELEASE_IMAGE
    only:
    - master
    when: manual
  </code></pre>
  
  <p>When I run the deploy action I actually get the following feedback in my log, but when I go check the server there is no container running. </p>
  
  <pre><code>$ docker run -d --name "review-$CI_COMMIT_REF_SLUG" -p "80:80" $RELEASE_IMAGE
  7bd109a8855e985cc751be2eaa284e78ac63a956b08ed8b03d906300a695a375
  Job succeeded
  </code></pre>
  
  <p>I have no clue as to what I am forgetting here. Am I right to expect this method to be correct for deploying containers? What am I missing / doing wrong?</p>
  
  <p><strong>tldr</strong>: <em>Want to deploy images into production using gitlab ci and docker-in-docker setup, job succeeds but there is no container. Goal is to have a running container on host after deployment.</em></p>