冲突。容器名称“ / gitlab-runner”已被容器使用 [英] Conflict. The container name "/gitlab-runner" is already in use by container
问题描述
我正在遵循此指南为我的GitLab服务器安装Docker运行在Ubuntu 16.4上。
I'm following this guide to install docker for my GitLab server running on Ubuntu 16.4.
当我执行以下命令时:
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
到目前为止很好。但是,当我运行下一条命令从此指南:
So far so good. However, when I run the next command to register the runner from this guide:
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner --name gitlab-runner gitlab/gitlab-runner register
我一直收到消息:
docker:守护程序的错误响应:冲突。容器名称 / gitlab-runner已被容器 b055ded012f9d0ed085fe84756604464afbb11871b432a21300064333e34cb1d使用。您必须删除(或重命名)该容器才能重新使用该名称。
docker: Error response from daemon: Conflict. The container name "/gitlab-runner" is already in use by container "b055ded012f9d0ed085fe84756604464afbb11871b432a21300064333e34cb1d". You have to remove (or rename) that container to be able to reuse that name.
但是,当我运行 docker容器列表
以查看容器列表,它为空。
However, when I run docker container list
to see the list of containers, it's empty.
有人知道我该如何解决此错误?
Anyone know how I can fix this error?
推荐答案
只需添加我的2美分,就像我最近也通过这些GitLab文档来使Docker GitLab运行程序正常工作一样。
Just to add my 2-cents as I've also recently been through those GitLab documents to get the Docker GitLab runner working.
遵循 Docker映像安装和配置指南,它告诉您启动该容器,但是我认为这是一个错误,并且您想要在注册Runner之后执行此操作。
Following the Docker image installation and configuration guide, it tells you to start that container, however that I believe, is a mistake, and you want to do that after registering the Runner.
如果您确实运行过:
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
只需删除<$ c的Docker容器$ c> docker rm -f gitlab-runner ,然后转到注册跑步者。
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner --name gitlab-runner gitlab/gitlab-runner register
这将注册运行程序,并将配置放在本地计算机上的 /srv/gitlab-runner/config/config.toml
中。
This would register the runner, and also place the configuration in /srv/gitlab-runner/config/config.toml
on the local machine.
然后您可以运行原始的 docker run
:
You can then run the original docker run
:
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
(注意,如果由于再次使用该名称而无法使用-请运行 docker rm -f gitlab-runner <再次使用/ code>命令-您将不会丢失gitlab-runner的配置。)
(NB, if this doesn't work because of the name being in use again - just run the docker rm -f gitlab-runner
command again - you won't lose the gitlab-runner configuration).
这将以配置集支持Docker gitlab-runner
And that would stand up the Docker gitlab-runner with the configuration set from the register command.
希望这会有所帮助!
这篇关于冲突。容器名称“ / gitlab-runner”已被容器使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!