我需要为elasticsearch服务启用脚本来运行我的rspec测试
# config/elasticsearch.yml
script.inline: on
script.indexed: on
我尝试在docker容器中按以下方式更改elasticsearch配置 .gitlab-ci.yml
:
rspec:
stage: test
services:
- mysql:5.6.42
- name: elasticsearch:1.6.1
command: ["echo 'script.inline: on' >> /etc/elasticsearch/elasticsearch.yml", "echo 'script.indexed: on' >> /etc/elasticsearch/elasticsearch.yml", "systemctl restart elasticsearch"]
...
但是服务容器启动失败
***WARNING: Service runner-6JNFXPMk-project-9870108-concurrent-0-elasticsearch-1 probably didn't start properly.
Health check error:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-6LBTXPMk-project-13870108-concurrent-0-elasticsearch-1 AS /runner-6LBTXPMk-project-13870108-concurrent-0-elasticsearch-1-wait-for-service/service (executor_docker.go:1318:0s)
Service container logs:
2018-12-26T11:07:47.604151437Z /docker-entrypoint.sh: line 20: /echo 'script.inline: on' >> /etc/elasticsearch/elasticsearch.yml: No such file or directory
*********
如何在gitlab ci上配置elasticsearch服务以启用脚本?
1条答案
按热度按时间rm5edbpk1#
看起来像
command
低于image
相当于CMD
在dockerfile中。正如将docker图像与gitlab ci文档一起使用时所说:应该用作容器命令的命令或脚本。它将被转换为在图像名称之后传递给docker的参数。语法类似于dockerfile的cmd指令,其中每个shell标记在数组中是一个单独的字符串。
我通过添加一个从
elasticsearch:1.6.1
:我创建了这个docker映像并推送到docker hub。现在我用它来生成elasticsearch服务,方法如下: