Container name conflict on "Run GitLab Runner in a container" documentation
From an extract of the instructions to run and register GitLab runner in a container:
- You need to mount a config volume into the
gitlab-runner
container to be used for configs and other resources:
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
- Register the Runner
To register a Runner using a Docker container:
Run the following command which will mount the Runner's config directory under /path/to/config:
docker run --rm -t -i -v /path/to/config:/etc/gitlab-runner --name gitlab-runner gitlab/gitlab-runner register
After issuing the command on step 3, the following error appears:
docker: Error response from daemon: Conflict. The container name "/gitlab-runner" is already in use by container "<container_id>". You have to remove (or rename) that container to be able to reuse that name.
The two docker run
commands use the same container --name
, hence the error.
It seems some other folks ran into this issue as well. Here's the same discussion on Stack Overflow, with some more feedback on this section of the docs.
Edited by David Planella