GitLab-CI:无法链接到未运行的容器 [英] GitLab-CI: Cannot link to a non running container

查看:124
本文介绍了GitLab-CI:无法链接到未运行的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用gitlab-ci进行设置.我有一个简单的gitlab-ci.yml文件

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

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

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?

先谢谢了 汤卡

推荐答案

您必须使用以下命令启动gitlab-runner容器

You must start the gitlab-runner container with

--privileged true

但这还不够.注册后由gitlab生成的任何运行器容器也必须具有特权.因此,您需要挂载gitlab-runner

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

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

and change privileged flag from false into true:

privileged = true

那将解决问题!

这篇关于GitLab-CI:无法链接到未运行的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆