1

我尝试在 LXD 容器内使用 docker executor 运行 GitLab Runner。已经完成了一半,但仍然无法正常运行。

有没有人碰巧启动并运行它并可以分享如何做到这一点?

4

2 回答 2

1

您必须将 docker 容器设置为以特权身份运行。检查运行器 config.toml 文件并设置如下:

[runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = true 
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    shm_size = 0
  [runners.cache]
    Insecure =  false

还要确保你已经使用参数启动了你的 LXC 容器:

lxc 启动 --verbose IMAGE CONTAINER_NAME -c security.nesting=true -c security.privileged=true

另外检查要设置的 LXC 配置文件,如下所示:

config:
  raw.lxc: |-
    lxc.apparmor.profile = unconfined
    lxc.cgroup.devices.allow = a
    lxc.mount.auto=proc:rw sys:rw
    lxc.cap.drop=
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: lxdbr0
    type: nic
  root:
    path: /
    pool: lxd-pa
    type: disk
name: default

如果即使这些设置也不会改变 docker 容器的行为,请尝试在 LXC 容器上禁用 apparmor

于 2019-02-21T15:15:39.693 回答