Registering a runner fails

I mean, it doesn’t “fail”, it’s certainly me doing something wrong, but I don’t know what, I’m a total beginner.

I’m following this official document.
I execute step 2:

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 \
  gitlab/gitlab-runner:latest

And then switch to step 3: Register the Runner, which leads me here.
I then execute the following:

docker run --rm -t -i -v /path/to/config:/etc/gitlab-runner --name gitlab-runner gitlab/gitlab-runner register

Which obviously doesn’t work, because I created the same container just before:

docker: Error response from daemon: Conflict. The container name "/gitlab-runner" is already in use by container "a19c56ccd3db1e826ae1d32045ee7ca4abd8bc1aea25b163c6d8565448a52863". You have to remove (or rename) that container to be able to reuse that name.

So I’m just lost, because simply following the documentation doesn’t seem to work… What am I doing wrong ?

Thanks a lot :slight_smile:

Hello,

try with “docker exec -it gitlab-runner gitlab-runner register”

1 Like

Thank you very much! It worked.

You Are Welcome