我有自己的CI服务器和gitlab,我正试图用这种配置运行docker runner(版本10.6):
image: php:7.1
services:
- mysql:latest
- redis:latest
- elasticsearch:latest
before_script:
- bash ci/install.sh > /dev/null
- php composer install -a
stages:
- test
test:
stage: test
variables:
API_ENVIRONMENT: 'test'
script:
- echo "Running tests"
- php composer app:tests
但是每当我用弹性拉动docker容器时,我都会收到错误消息:
*** WARNING: Service runner-1de473ae-project-225-concurrent-0-elasticsearch-2 probably didn't start properly.
Error response from daemon: Conflict. The container name "/runner-1de473ae-project-225-concurrent-0-elasticsearch-2-wait-for-service" is already in use by container "f26f56b2905e8c3da1977bc7c48e7eba00e943532146b7a8711f91fe67b67c3b". You have to remove (or rename) that container to be able to reuse that name.
*********
我还尝试登录此服务器并列出所有容器,但只有redis:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5cec961e03b2 811c03fb36bc "gitlab-runner-ser..." 39 hours ago Up 39 hours runner-1de473ae-project-247-concurrent-1-redis-1-wait-for-service
在Google上搜索此问题后,我发现了这个问题:https://gitlab.com/gitlab-org/gitlab-runner/issues/2667然后我将跑步者更新为10.6,但问题仍然存在。
毕竟,我的服务器上没有运行弹性,然后我的测试失败了:
FAILED: Battle/BattleDataElasticProviderTest.php method=testGetLocalBattles
Exited with error code 255 (expected 0)
Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster
有没有办法,如何启动ES或至少让ES进入更加动词模式?
谢谢!
答案 0 :(得分:2)
当容器停止时,即使它现在处于退出状态,它仍然存在。使用命令docker ps -a
显示所有正在运行和已退出的容器。
要使用现有名称启动新容器,您需要先使用docker rm
手动删除占用此名称的旧容器。
一种方便的方法是在启动容器时使用--rm
参数,容器一旦停止就会自动删除。