简体   繁体   English

Docker无法在gitlab Runner中运行,可能是什么问题?

[英]Docker not working in gitlab runner, what could be the problem?

When I try to run my gitlab-ci.yml , I get the following error: 当我尝试运行gitlab-ci.yml ,出现以下错误:

/bin/bash: line 73: docker: command not found / bin / bash:第73行:docker:找不到命令

On my server the docker command works as root and gitlab is also executing as root. 我的服务器上的docker命令用作根和gitlab也被执行为根。

What could be the problem here? 这可能是什么问题?

Here is my .yml file: 这是我的.yml文件:

stages:
  - deploy
  - cleanup

before_script:
  - whoami
  - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"

You can verify these 3 steps: 您可以验证以下3个步骤:

  1. Is Docker Engine installed on server 服务器上是否安装了Docker Engine
  2. Is the gitlab-runner user added to docker group gitlab-runner用户是否已添加到docker
  3. Has the gitlab-runner access to Docker gitlab-runner可以访问Docker

Follow the official page for more information: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html 请关注官方页面以获取更多信息: https : //docs.gitlab.com/ee/ci/docker/using_docker_build.html

Your gitlab-ci.yml looks incomplete. 您的gitlab-ci.yml看起来不完整。 Try something like this: 尝试这样的事情:

stages:
  - build

build-docker:
  stage: build
  script:
     - whoami
     - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM