Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有docker executor的gitlab runner找不到像maven:3.3.9-jdk-8这样的官方图像_Maven_Docker_Gitlab_Gitlab Ci_Gitlab Ci Runner - Fatal编程技术网

带有docker executor的gitlab runner找不到像maven:3.3.9-jdk-8这样的官方图像

带有docker executor的gitlab runner找不到像maven:3.3.9-jdk-8这样的官方图像,maven,docker,gitlab,gitlab-ci,gitlab-ci-runner,Maven,Docker,Gitlab,Gitlab Ci,Gitlab Ci Runner,正在尝试将gitlab runner与docker executor一起使用。我使用的是标准的maven.gitlab ci.yml模板,它标识库映像maven:3.3.9-jdk-8 出于某种原因,我出现了以下错误: Running with gitlab-ci-multi-runner 1.11.0 (33af656) on 4caf1e03c61d (0cb58cc5) Using Docker executor with image maven:3.3.9-jdk-8 ... ERR

正在尝试将gitlab runner与docker executor一起使用。我使用的是标准的maven
.gitlab ci.yml
模板,它标识库映像
maven:3.3.9-jdk-8

出于某种原因,我出现了以下错误:

Running with gitlab-ci-multi-runner 1.11.0 (33af656)
  on 4caf1e03c61d (0cb58cc5)
Using Docker executor with image maven:3.3.9-jdk-8 ...
ERROR: Preparation failed: no such image
Will be retried in 3s ...
Using Docker executor with image maven:3.3.9-jdk-8 ...
ERROR: Preparation failed: no such image
Will be retried in 3s ...
Using Docker executor with image maven:3.3.9-jdk-8 ...
ERROR: Preparation failed: no such image
Will be retried in 3s ...
ERROR: Job failed (system failure): no such image
当我
docker exec-it服务器\u gitlab-runner\u 1 bash
进入容器时,我可以访问互联网,因此我认为这不是连接问题

这是我的
config.toml
文件:

concurrent = 1
check_interval = 0

[[runners]]
  name = "xxx"
  url = "http://gitlab/"
  token = "xxx"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "ubuntu"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    network_mode = "server_default"
    volumes_from = ["nginx:rw"]
  [runners.cache]
version: '2.0'
services:

  nginx:
    image: "nginx"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "./nginx/conf:/etc/nginx/conf.d"
      - "./nginx/ssl:/etc/nginx/ssl"
    restart: always

  gitlab:
    image: "gitlab/gitlab-ce"
    volumes:
      - "./gitlab/config:/etc/gitlab"
      - "./gitlab/logs:/var/log/gitlab"
      - "./gitlab/data:/var/opt/gitlab"
    restart: always

  gitlab-runner:
    image: "gitlab/gitlab-runner"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./gitlab-runner/config:/etc/gitlab-runner"
    restart: always
我用来启动gitlab runner容器的命令是
docker compose up
,下面是我的
docker compose.yml
文件:

concurrent = 1
check_interval = 0

[[runners]]
  name = "xxx"
  url = "http://gitlab/"
  token = "xxx"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "ubuntu"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    network_mode = "server_default"
    volumes_from = ["nginx:rw"]
  [runners.cache]
version: '2.0'
services:

  nginx:
    image: "nginx"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "./nginx/conf:/etc/nginx/conf.d"
      - "./nginx/ssl:/etc/nginx/ssl"
    restart: always

  gitlab:
    image: "gitlab/gitlab-ce"
    volumes:
      - "./gitlab/config:/etc/gitlab"
      - "./gitlab/logs:/var/log/gitlab"
      - "./gitlab/data:/var/opt/gitlab"
    restart: always

  gitlab-runner:
    image: "gitlab/gitlab-runner"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./gitlab-runner/config:/etc/gitlab-runner"
    restart: always
我的
.gitlab ci.yml
文件是:

# This file is a template, and might need editing before it works on your project.
---
# Build JAVA applications using Apache Maven (http://maven.apache.org)
# For docker image tags see https://hub.docker.com/_/maven/
#
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
# 
# This template will build and test your projects as well as create the documentation.
# 
# * Caches downloaded dependencies and plugins between invocation.
# * Does only verify merge requests but deploy built artifacts of the
#   master branch.
# * Shows how to use multiple jobs in test stage for verifying functionality
#   with multiple JDKs.
# * Uses site:stage to collect the documentation for multi-module projects.
# * Publishes the documentation for `master` branch.

variables:
  # This will supress any download for dependencies and plugins or upload messages which would clutter the console log.
  # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
  MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
  # As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
  # when running from the command line.
  # `installAtEnd` and `deployAtEnd`are only effective with recent version of the corresponding plugins.
  MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

# Cache downloaded dependencies and plugins between builds.
cache:
  paths:
    - /root/.m2/repository/

# This will only validate and compile stuff and run e.g. maven-enforcer-plugin. 
# Because some enforcer rules might check dependency convergence and class duplications
# we use `test-compile` here instead of `validate`, so the correct classpath is picked up.
.validate: &validate
  stage: build
  script:
    - 'mvn $MAVEN_CLI_OPTS test-compile'

# For merge requests do not `deploy` but only run `verify`.
# See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
.verify: &verify
  stage: test
  script:
    - 'mvn $MAVEN_CLI_OPTS verify site site:stage'
  except:
    - master

# Validate merge requests using JDK7
validate:jdk7:
  <<: *validate
  image: maven:3.3.9-jdk-7

# Validate merge requests using JDK8
validate:jdk8:
  <<: *validate
  image: maven:3.3.9-jdk-8

# Verify merge requests using JDK7
verify:jdk7:
  <<: *verify
  image: maven:3.3.9-jdk-7

# Verify merge requests using JDK8
verify:jdk8:
  <<: *verify
  image: maven:3.3.9-jdk-8


# For `master` branch run `mvn deploy` automatically.
# Here you need to decide whether you want to use JDK7 or 8.
# To get this working you need to define a volume while configuring your gitlab-ci-multi-runner.
# Mount your `settings.xml` as `/root/.m2/settings.xml` which holds your secrets.
# See https://maven.apache.org/settings.html
deploy:jdk8:
  # Use stage test here, so the pages job may later pickup the created site.
  stage: test
  script:
    - 'mvn $MAVEN_CLI_OPTS deploy site site:stage'
  only:
    - master
  # Archive up the built documentation site.
  artifacts:
    paths:
    - target/staging
  image: maven:3.3.9-jdk-8


pages:
  image: busybox:latest
  stage: deploy
  script:
    # Because Maven appends the artifactId automatically to the staging path if you did define a parent pom,
    # you might need to use `mv target/staging/YOUR_ARTIFACT_ID public` instead.
    - mv target/staging public
  dependencies:
    - deploy:jdk8
  artifacts:
    paths:
    - public
  only:
    - master
#此文件是一个模板,可能需要在项目上运行之前进行编辑。
---
#使用ApacheMaven构建JAVA应用程序(http://maven.apache.org)
#有关docker图像标记,请参见https://hub.docker.com/_/maven/
#
#有关一般生命周期信息,请参阅https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
# 
#此模板将构建和测试您的项目以及创建文档。
# 
#*在调用之间缓存下载的依赖项和插件。
#*只验证合并请求,但部署
#主分支。
#*演示如何在测试阶段使用多个作业来验证功能
#使用多个jdk。
#*使用site:stage收集多模块项目的文档。
#*出版“master”分支机构的文件。
变量:
#这将禁止任何依赖项和插件的下载,或上传会扰乱控制台日志的消息。
#'showDateTime'将以毫秒为单位显示经过的时间。您需要指定“---batch mode”才能使其正常工作。
MAVEN_选择:“-Dorg.slf4j.simpleLogger.log.org.apache.MAVEN.cli.transfer.Slf4jMavenTransferListener=WARN-Dorg.slf4j.simpleLogger.showDateTime=true-Djava.awt.headless=true”
#从Maven 3.3.0开始,您可以在“.mvn/Maven.config”中定义这些选项,因此使用相同的配置
#从命令行运行时。
#'installAtEnd'和'deployAtEnd'仅对最新版本的相应插件有效。
MAVEN_CLI_选择:“--批处理模式--错误--结束时失败--显示版本-DinstallAtEnd=true-DdeployAtEnd=true”
#在构建之间缓存下载的依赖项和插件。
隐藏物:
路径:
-/root/.m2/存储库/
#这将只验证和编译东西,并运行例如maven enforcer插件。
#因为一些强制规则可能会检查依赖项聚合和类复制
#我们在这里使用'test compile'而不是'validate',因此会选择正确的类路径。
.validate:&验证
阶段:建造
脚本:
-“mvn$MAVEN_CLI_选择测试编译”
#对于合并请求,不执行“部署”,只运行“验证”。
#看https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
.verify:&验证
阶段:测试
脚本:
-'mvn$MAVEN_CLI_选择验证站点站点:阶段'
除:
-主人
#使用JDK7验证合并请求
验证:jdk7:

很抱歉,请问您与docker exec连接到哪个容器?你是在docker容器中运行gitlab ci mutli runner吗?我想这个图像现在被称为gitlab/gitlab runner,但是是的。()在这种情况下,请添加用于运行它的命令。我在gitlab runner中遇到过类似的问题。我找不到根本原因,但对于我来说,使用
docker rmi
删除构建环境映像(在您的例子中是
maven:3.3.9-jdk-8
)会有所帮助。有时我还不得不删除服务映像(虽然您似乎没有使用它们)。很抱歉问一下,您与docker exec连接到哪个容器?你是在docker容器中运行gitlab ci mutli runner吗?我想这个图像现在被称为gitlab/gitlab runner,但是是的。()在这种情况下,请添加用于运行它的命令。我在gitlab runner中遇到过类似的问题。我找不到根本原因,但对于我来说,使用
docker rmi
删除构建环境映像(在您的例子中是
maven:3.3.9-jdk-8
)会有所帮助。有时我还不得不删除服务映像(尽管您似乎没有使用它们)。