title: Local ci pipeline with gitlab using docker
body: <p>I installed gitlab via docker locally successfully on port 9800 in an own network "cinet". Now I would like to set up a ci pipeline. For that I first have to install a gitlab-runner and then to register it. The registration fails, however.</p>
  
  <p>Starting gitlab like so</p>
  
  <pre><code>$ docker run --name=gitlab --volume="/srv/gitlab/config:/etc/gitlab" --volume="/srv/gitlab/logs:/var/log/gitlab" --volume="/srv/gitlab/data:/var/opt/gitlab" -p 9800:80 -p 22:22 -p 443:443 --network=cinet --restart=no --detach=true gitlab/gitlab-ce:latest
  </code></pre>
  
  <p>The gui is ready under <code>http://localhost:9800</code>. I created a java maven projekts with a .gitlab-ci.yml and pushed it into my local gitlab instance successfully. The ci pipeline is stuck as expected since there is no runner yet intalled/registered.</p>
  
  <p><a href="https://docs.gitlab.com/runner/install/docker.html" rel="nofollow noreferrer">Installing the runner</a></p>
  
  <pre><code>$ docker run -d --name gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock --network=cinet gitlab/gitlab-runner
  </code></pre>
  
  <p><a href="https://docs.gitlab.com/runner/register/index.html#docker" rel="nofollow noreferrer">Registering the runner</a>. I first tried a shared runner and obtained the token from the ci gui.</p>
  
  <pre><code>$ docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner --network=cinet gitlab/gitlab-runner register
  </code></pre>
  
  <p>The I am prompted for host, token, description and tags. Tags I left empty. For host I tried:</p>
  
  <ol>
  <li><code>http://localhost:9800/</code> - That results in the following error: </li>
  </ol>
  
  <pre><code>ERROR: Registering runner... failed                 runner=Lt7NVbJ_ status=couldn't execute POST against http://localhost:9800/api/v4/runners: Post http://localhost:9800/api/v4/runners: dial tcp 127.0.0.1:9800: connect: connection refused
  PANIC: Failed to register this runner. Perhaps you are having network problems 
  </code></pre>
  
  <ol start="2">
  <li><code>http://172.19.0.2:9800/</code> - That results in the following error:</li>
  </ol>
  
  <pre><code>ERROR: Registering runner... failed                 runner=Lt7NVbJ_ status=couldn't execute POST against http://172.19.0.2:9800/api/v4/runners: Post http://172.19.0.2:9800/api/v4/runners: dial tcp 172.19.0.2:9800: connect: connection refused
  PANIC: Failed to register this runner. Perhaps you are having network problems
  </code></pre>
  
  <p>Why is that failing? What do I need to do to make that run?</p>