我遇到了附加服务的GitLab Runner的问题。每当作业运行时,一旦等待服务完成,它就会给我一个警告:
ContainerStart:来自守护进程的错误响应:无法链接到非运行容器:/ runner-b565e58e-project-4-concurrent-0-mysql-0 AS / runner-b565e58e-project-4-concurrent-0-mysql- 0-等待换服务/服务
stages:
- test
test:
stage: test
image: primus852/gitlab:latest
services:
- name: mysql:latest
command: ["cp tests/Files/db.sql /docker-entrypoint-initdb.d/"]
...
[runners.docker]
tls_verify = false
image = "php:fpm-alpine"
privileged = true
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache"]
shm_size = 0
...
gitlab-runner
以此开头:
sudo docker run -d --name gitlab-runner --privileged --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:latest
所以我觉得privileged
的东西有问题,但是有人看到了这可能是什么吗?
答案 0 :(得分:2)
您用command: ["mysqld"]
覆盖了服务容器command: ["cp tests/Files/db.sql /docker-entrypoint-initdb.d/"]
,因此服务容器会复制文件并在此后停止,就像您要求的那样。
因此请更改为command: ["cp tests/Files/db.sql /docker-entrypoint-initdb.d/ & mysqld"]
,以便在cp命令后启动mysql