GitLab-CI:无法链接到非运行容器

时间:2017-05-30 08:26:44

标签: gitlab gitlab-ci gitlab-ci-runner

我试图让我的设置与gitlab-ci一起工作。我有一个简单的gitlab-ci.yml文件

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

我希望安装一个带有gcc和cmake(apt-get版本为旧版本)的ubuntu 14.04 LTS。如果我在本地使用它(通过docker --link命令)一切正常,但是当gitlab-ci-runner将处理它时,我得到以下警告(在我的情况下是一个错误)

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

有人知道如何解决这个问题吗?

提前致谢 通卡

1 个答案:

答案 0 :(得分:12)

您必须使用

启动gitlab-runner容器
--privileged true

但这还不够。注册后由gitlab旋转的任何跑步者容器也需要特权。所以你需要挂载gitlab-runner

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

并将特权标志从false更改为true:

privileged = true

那将解决问题!