Gitlab CI连接被Elasticsearch拒绝

时间:2020-02-19 07:27:16

标签: docker elasticsearch gitlab gitlab-ci gitlab-ci-runner

我尝试在Gitlab CI上连接elasticsearch以运行测试,但始终被拒绝连接

这是我的脚本

services:
      - name: docker.elastic.co/elasticsearch/elasticsearch:7.6.0          
        command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
script:
      - curl "http://$(cat /etc/hosts |grep $HOSTNAME|cut -d$'\t' -f1):9200"

$(cat /etc/hosts |grep $HOSTNAME|cut -d$'\t' -f1)我可以获取IP地址

我尝试使用alias: elasticsearch,但是当我curl "http://elasticsearch:9200"时也遇到错误Could not resolve host

0 个答案:

没有答案