简体   繁体   English

gitlab-runner docker:找不到命令

[英]gitlab-runner docker: command not found

I'm trying to build docker container using GitLab runner.我正在尝试使用 GitLab 跑步者构建 docker 容器。 (lead dev left company, and now I have no idea how to do it.) (主要开发人员离开了公司,现在我不知道该怎么做。)

I'll share everything I can.我会分享我能分享的一切。

Build output构建 output 输出错误

as I understand from output runner is assigned correctly, the problem is with docker据我了解,output 跑步者分配正确,问题出在 docker

the runner is running as Shell executor跑步者作为 Shell 执行者运行

here is .gitlab-ci.yml这是.gitlab-ci.yml

stages:
  - build
  - deploy

variables:
  STACK_NAME: isnta_api
  VERSION: ${CI_COMMIT_TAG}
  IMAGE_NAME: ${DOCKER_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_TAG}

before_script:
  - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
  - echo $STACK_NAME
  - echo $CI_REGISTRY
  - echo $IMAGE_NAME

build:
  stage: build
  only:
    - tags
  script:
    - docker build -f Dockerfile -t ${IMAGE_NAME}  .
    - docker push ${IMAGE_NAME}

deploy:
  stage: deploy
  only:
    - tags
  script:
    - docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${STACK_NAME}

docker-compose.yml docker-compose.yml

version: '3.7'

services:
  app:
    container_name: ${STACK_NAME}
    image: ${IMAGE_NAME}
    environment:
      PORT: 4042
      APP_ENV: production
      INSTAGRAM_API_KEY: de194cf559msh8d940d38fd1ca47p129005jsnc11b4fd77a36
      INSTAGRAM_API_HOST_NAME: instagram-bulk-profile-scrapper.p.rapidapi.com
      INSTAGRAM_API_BASE_URL: https://instagram-bulk-profile-scrapper.p.rapidapi.com/clients/api/ig/
    networks:
      - nxnet
    ports:
      - 4042:4042
    deploy:
      replicas: 1
      update_config:
        order: start-first

networks:
  nxnet:
    external: true

and DockerfileDockerfile

FROM node:14-alpine

COPY . /app

WORKDIR /app
RUN apk add --no-cache bash
RUN npm install

RUN npm run build

CMD npm run start:prod

Any suggestions or tips would be valuable.任何建议或提示都会很有价值。 Thank you in advance先感谢您

It looks like your Gitlab Runner does not have the capabilities to run Docker commands.看起来您的 Gitlab Runner 没有运行 Docker 命令的能力。

To enable your Gitlab Runner to run Docker commands you can:要使您的 Gitlab Runner 能够运行 Docker 命令,您可以:

  1. Modify your Gitlab Runner to use the Docker Executor修改您的 Gitlab Runner 以使用Docker 执行器
  2. Use one of the approaches in this document to enable docker commands in your existing Gitlab runner使用本文档中的一种方法在现有 Gitlab 运行器中启用 docker 命令

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

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