Gitlab CI / Docker:使用自定义图像作业

这是我如何做一些棉绒testing(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 . 

但是,每个testing都需要将软件包安装到Ubuntu镜像,这需要花费时间。

所以我想用这个来build立一个图像。 我想出了这个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显示了我的确切形象…

你需要编辑你的runner机器上的/etc/gitlab-runner config.toml文件,内容如下

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

这里看到相关的问题。