docker - Docker在GitLab CI运行器容器中不可用

标签 docker gitlab gitlab-ci gitlab-ci-runner

我正在尝试使用digitallumberjack提供的GitLab CI运行程序,因为它提供了在容器内使用Docker命令的支持。

GitLab CI运行器脚本:

docker run --name gitlab-ci-multi-runner -d --restart=always \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /mnt/data/gitlab/gitlab-runner:/home/gitlab_ci_multi_runner/data \
  --env='CI_SERVER_URL=https://gitlab.dev.abc.net/ci' --env='RUNNER_TOKEN=RijUZPnMjGeNF2JYt' \
  --env='RUNNER_DESCRIPTION=runnerA' --env='RUNNER_EXECUTOR=docker' \
  --env='RUNNER_DOCKER_IMAGE=docker:17.07.0-ce' --env='RUNNER_DOCKER_MODE=socket' \
  --link gitlab.dev.abc.net \
  digitallumberjack/docker-gitlab-ci-multi-runner:v9.3.0-1
.gitlab-ci.yml内容:
image: node:6.11

types:
        - build
        - deploy

build_app:
        type: build
        script: "bash chmod +x ./configure_proxy_artifactory.sh"
        script: "bash ./configure_proxy_artifactory.sh"

但是,当运行GitLab CI构建时,运行程序日志中出现以下错误:
./configure_proxy_artifactory.sh: line 13: docker: command not found

似乎Docker仍未使用上述运行程序脚本配置。知道我该如何解决吗?

更新:从容器内部,这是我的观察:
root@5489eb3ebe42:/home/gitlab_ci_multi_runner# ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jul 21 00:53 /var/run/docker.sock
root@5489eb3ebe42:/home/gitlab_ci_multi_runner# docker ps
bash: docker: command not found

最佳答案

我不确定您为什么不使用官方的Gitlab Runner图像:gitlab / gitlab-runner:latest,但我相信这只是一个偏爱,我建议您也应该传递--privileged标志,看看是否有帮助。

关于docker - Docker在GitLab CI运行器容器中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46411242/

相关文章:

android - Gitlab CI :- How to create the Shared Runner in Gitlab which does not depend on the any system?

gitlab-ci - 执行 : "pwsh": executable file not found in %PATH%

docker - Docker在同一容器上运行 “pip install”和 “npm install”彼此覆盖

docker - 在 kubernetes 中的 asp.net 核心容器中登录重置/丢失

docker - 不能使用带有psycopg2的另一个python3容器中的postgres容器

git - 多个 git post-receive Hook

amazon-web-services - ECS/ECR : is common practice to have one repository per image (and associated versions)?

git - 在 gitlab 上克隆私有(private)仓库无需密码即可工作吗?

ssl - gitLab 更新 : curl returns ssl error 35

java - 如何使用 GitLab runner 运行 spring-boot 应用程序?