docker compose在gitlab作业中找不到文件

yrdbyhpb  于 2022-11-02  发布在  Docker
关注(0)|答案(1)|浏览(223)

我正在使用gitlab-runner运行一个gitlab-ci.yml作业,该作业使用docker执行程序,并从主机装载docker.sock(在配置文件中设置)。
docker在以下位置编写run.sh文件:https://github.com/docker/compose/blob/master/script/run/run.sh似乎找不到我需要它运行的docker-compose.lint.yml文件。
gitlab-ci.yml文件的一部分:

Lint from image:
  <<: *temp
  stage: Lint
  script:
    - ls -a
    - cat docker-compose.lint.yml
    - . docker-compose_run.sh -f docker-compose.lint.yml up --remove-orphans --force-recreate --abort-on-container-exit

gitlab-ci.yml文件正在使用的映像的停靠文件:

FROM debian:stretch

# Set Bash as default shell

RUN rm /bin/sh && \
    ln --symbolic /bin/bash /bin/sh

    # apt-get
RUN apt-get update && \
    apt-get install -y \
    # Install SSH
    openssh-client \
    openssh-server \
    openssl \
    # Install cURL
    curl \
    # Install git
    git \
    # Install locales
    locales \
    # Install Python
    python3 \
    python-dev \
    python3-pip \
    # Build stuff
    build-essential \
    libssl-dev \
    libffi-dev \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg2 \
    software-properties-common

# Install Docker

    # Add Docker’s official GPG key
RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - && \
    # Set up the stable repository
    add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
   $(lsb_release -cs) \
   stable" && \
    # Update package index
    apt-get update && \
    # Install Docker CE
    apt-get install -y docker-ce

    # pip
RUN pip3 install \
    # Install Docker Compose
    docker-compose

# Set locale

RUN sed --in-place '/en_US.UTF-8/s/^# //' /etc/locale.gen && \
    locale-gen && \
    # Set system locale (add line)
    echo "export LANG=en_US.UTF-8" >> /etc/profile && \
    # Set system timezone (add line)
    echo "export TZ=UTC" >> /etc/profile

工作输出:

...more stuff above here
$ ls -a
.
..
.clocignore
.dockerignore
.eslintignore
.eslintrc.json
.git
.gitignore
.gitlab-ci.yml
.nvmrc
.nyc_output
Dockerfile
README.md
__.gitlab-ci.yml
bin
build.sh
build_and_test.sh
coverage
docker-compose.lint.yml
docker-compose.test.yml
docker-compose_run.sh
lib
package-lock.json
package.json
stop.sh
test
test.sh
wait-for-vertica.sh
$ cat docker-compose.lint.yml
version: "3"

services:
  ei:
    image: lint:1
    environment:
      - NODE_ENV=test
    entrypoint: ["npm", "run", "lint"]
$ . docker-compose_run.sh -f docker-compose.lint.yml up --remove-orphans --force-recreate --abort-on-container-exit
.IOError: [Errno 2] No such file or directory: u'./docker-compose.lint.yml'
ERROR: Job failed: exit code 1
brtdzjyr

brtdzjyr1#

因为这个问题是我搜索的最佳谷歌结果:

executor failed running [/bin/sh -c apt-get install git-all]: exit code: 1

为了解决我的问题,我在apt-get命令中添加了-y,更改如下:

apt-get install git-all

到这个

apt-get install git-all -y

相关问题