Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab-CI: Cannot link to a non running container

I've tried to get my setup work with gitlab-ci. I have a simple gitlab-ci.yml file

build_ubuntu:
  image: ubuntu:14.04
  services:
    - rikorose/gcc-cmake:gcc-5
  stage: build
  script:
    - apt-get update
    - apt-get install -y python3 build-essential curl
    - cmake --version
  tags:
    - linux

I want to get a ubuntu 14.04 LTS with gcc and cmake (apt-get version is to old) installed. If i use it locally (via docker --link command) everything works, but when the gitlab-ci-runner will process it i get the following waring (which is in my case an error)

Running with gitlab-ci-multi-runner 9.2.0 (adfc387)
on xubuntuci1 (19c6d3ce)
Using Docker executor with image ubuntu:14.04 ...
Starting service rikorose/gcc-cmake:gcc-5 ...
Pulling docker image rikorose/gcc-cmake:gcc-5 ...
Using docker image rikorose/gcc-cmake:gcc-5 
ID=sha256:ef2ac00b36e638897a2046c954e89ea953cfd5c257bf60103e32880e88299608 
for rikorose/gcc-cmake service...
Waiting for services to be up and running...

*** WARNING: Service runner-19c6d3ce-project-54-concurrent-0-rikorose__gcc-
cmake probably didn't start properly.

Error response from daemon: Cannot link to a non running container: /runner-
19c6d3ce-project-54-concurrent-0-rikorose__gcc-cmake AS /runner-19c6d3ce-
project-54-concurrent-0-rikorose__gcc-cmake-wait-for-service/runner-
19c6d3ce-project-54-concurrent-0-rikorose__gcc-cmake

Does anybody know how i can fix this?

Thanks in advance Tonka

like image 917
Michael Aigner Avatar asked May 30 '17 08:05

Michael Aigner


Video Answer


1 Answers

You must start the gitlab-runner container with

--privileged true

but that is not enough. Any runner containers that are spun up by gitlab after registering need to be privileged too. So you need to mount the gitlab-runner

docker exec -it runner /bin/bash
nano /etc/gitlab-runner/config.toml

and change privileged flag from false into true:

privileged = true

That will solve the problem!

note: you can also mount the config.toml as a volume on the container then you won't have to log into the container to change privileged to true because you can preconfigure the container before running it.

like image 190
wendellmva Avatar answered Sep 20 '22 10:09

wendellmva