Elasticsearch服务无法启动gitlab - docker容器已在使用中

问题描述 投票:0回答:1

我有自己的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

谷歌搜索这个问题后,我发现了这个问题: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置于更加动词模式?

谢谢!

docker elasticsearch gitlab gitlab-ci
1个回答
2
投票

当容器停止时,即使它现在处于退出状态,它仍然存在。使用命令docker ps -a显示所有正在运行和已退出的容器。

要使用现有名称启动新容器,您需要首先使用docker rm手动删除占用此名称的旧容器。

一种方便的方法是在启动容器时使用--rm参数,容器将在停止后自动删除。

© www.soinside.com 2019 - 2024. All rights reserved.