I have an issue with a GitLab Runner that has a service attached. Whenever the job is run, as soon as waiting for the service is completed, it gives me a warning:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-b565e58e-project-4-concurrent-0-mysql-0 AS /runner-b565e58e-project-4-concurrent-0-mysql-0-wait-for-service/service
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
...
And the gitlab-runner
is started with this:
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
So I guess something is wrong with the privileged
stuff, but does anybody see what that may be?
gitlab-ci. yml scripts are running as user gitlab-www now. If this one has same uid as host mounts, you are also able to deploy directly to host folders.
In general, the version of Docker Engine and the version of the GitLab Runner container image do not have to match. The GitLab Runner images should be backwards and forwards compatible. However, to ensure you have the latest features and security updates, you should always use the latest stable Docker Engine version.
For a container to run as a privileged application, the user must “flag” it to enable all capabilities to the container or pod. In other words, when a container is in a privileged mode, you are giving the container all the capabilities that a host can perform.
you overwrite the service container command: ["mysqld"]
with command: ["cp tests/Files/db.sql /docker-entrypoint-initdb.d/"]
, so the service container copies the files and stops after that, like you asked it to do.
so change to command: ["cp tests/Files/db.sql /docker-entrypoint-initdb.d/ & mysqld"]
in order to start mysql after the cp-command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With