gpt4 book ai didi

docker - Gitlab CI/Docker : Use custom image for job

转载 作者:IT老高 更新时间:2023-10-28 21:18:57 24 4
gpt4 key购买 nike

这就是我做一些 linter 测试 (eslint) 的方式。

linter:
image: ubuntu:16.04
stage: test
tags:
- testing
before_script:
- apt-get update -y
- apt-get install nodejs-legacy -yqq
- apt-get install curl -yqq
- curl https://install.meteor.com/ | sh
- meteor npm install eslint eslint-plugin-react
script:
- ./node_modules/.bin/eslint --ext .js --ext .jsx .

但是每次测试都必须将软件包安装到 ubuntu 镜像中,这需要时间。

所以我想用这个来构建一个图像。我想出了这个 Dockerfile:

FROM ubuntu:16.04
RUN apt-get update -y
RUN apt-get install nodejs-legacy -yqq
RUN apt-get install curl -yqq
RUN apt-get clean && apt-get autoclean && apt-get autoremove
RUN curl https://install.meteor.com/ | sh

那我做

$ docker build -t linter-testing:latest .

还有这个 yml 文件:

linter:
image: linter-testing:latest
stage: test
tags:
- testing
before_script:
- meteor npm install eslint eslint-plugin-react
script:
- ./node_modules/.bin/eslint --ext .js --ext .jsx .

但它失败并出现此错误:

ERROR: Job failed: Error response from daemon: repository linter-testing not found: does not exist or no pull access

那么为什么这个图像不存在,尽管 docker images 向我显示了那个图像...

最佳答案

您需要编辑 config.toml 文件,该文件位于运行器机器上的 /etc/gitlab-runner 中,使用以下内容

[runners.docker]
pull_policy = "if-not-present"

查看相关问题 here .

关于docker - Gitlab CI/Docker : Use custom image for job,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43481618/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com