gitlab-runner docker: command not found



  • I'm trying to build docker container using GitLab runner. (lead dev left company, and now I have no idea how to do it.)

    I'll share everything I can.

    Build output output error

    as I understand from output runner is assigned correctly, the problem is with docker

    the runner is running as Shell executor

    here is .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

    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 Dockerfile

    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



  • Do you know for sure if Docker is installed on the machine/VM that has the runner on it? Depending on your setup, you can SSH into the machines that host the Gitlab runners and just do docker --version.

    If it's not on there, then you will need to visit https://docs.docker.com/engine/install/ and add it.

    I ran into the same situation, coming into a project that used GitLab runners with no prior experience - at the end of the day, a GitLab runner is just a program that can run on any machine. Depending on how your CI/CD is configured, it may be on a development VM, server, workstation, etc. Good luck!




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2