当前位置: 首页 > 知识库问答 >
问题:

OpenShift:构建映像时Fabric部署失败

荆利
2023-03-14

我试图使用Fabric8 Maven插件部署示例项目。https://github.com/jbossdemocentral/katacoda-fuse-getting-started.git

我在远程机器中有一个启动并运行的Openshift环境,我正在使用“oc登录…”连接到它

本地html" target="_blank">开发机器设置:有docker,maven。已安装oc。

  OS: Mac OS
  > docker version
  Client:
  Version:      1.11.2
  API version:  1.23
  Go version:   go1.5.4
  Git commit:   b9f10c9
  Built:        Wed Jun  1 21:20:08 2016
  OS/Arch:      darwin/amd64

 Server:
 Version:      18.05.0-ce
 API version:  1.37
 Go version:   go1.10.1
 Git commit:   f150324
 Built:        Wed May  9 22:20:42 2018
 OS/Arch:      linux/amd64

>> oc version
oc v3.9.25
kubernetes v1.9.1+a0ce1bc657

当我从命令提示符下运行示例项目“mvn fabric8:deploy”时,构建失败,出现以下错误:

Error Logs:


      [DEBUG] Trying to configure client from Kubernetes config...
      [DEBUG] Found for Kubernetes config at: [/Users/apiteam/.kube/config].
      [WARNING] F8: Cannot access cluster for detecting mode: Unknown host placholder.openshiftenv.com
     [INFO] F8: Building Docker image in Kubernetes mode
     [INFO] F8: spring-boot: Using fat jar packaging as the spring boot plugin is using `repackage` goal execution
     [INFO] F8: Running generator spring-boot
     [INFO] F8: spring-boot: Using Docker image jboss-fuse-6/fis-java-openshift:2.0 as base / builder
     [ERROR] F8: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
     [INFO] ------------------------------------------------------------------------
     [INFO] BUILD FAILURE
     [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 01:22 min
      [INFO] Finished at: 2018-05-15T14:42:21+05:30
      [INFO] Final Memory: 52M/400M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build (default) on project fuse-camel-sb-rest: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0': Get https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0: Get https://auth.docker.io/token?scope=repository%3Ajboss-fuse-6%2Ffis-java-openshift%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) (Internal Server Error: 500) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build (default) on project fuse-camel-sb-rest: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
    at io.fabric8.maven.plugin.mojo.build.BuildMojo.buildAndTag(BuildMojo.java:242)
    at io.fabric8.maven.docker.BuildMojo.executeInternal(BuildMojo.java:47)
    at io.fabric8.maven.plugin.mojo.build.BuildMojo.executeInternal(BuildMojo.java:218)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:193)
    at io.fabric8.maven.plugin.mojo.build.BuildMojo.execute(BuildMojo.java:201)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 24 more
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
    at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.pullImage(DockerAccessWithHcClient.java:369)
    at io.fabric8.maven.docker.AbstractDockerMojo.checkImageWithAutoPull(AbstractDockerMojo.java:439)
    at io.fabric8.maven.docker.AbstractBuildSupportMojo.autoPullBaseImage(AbstractBuildSupportMojo.java:110)
    at io.fabric8.maven.docker.AbstractBuildSupportMojo.buildImage(AbstractBuildSupportMojo.java:63)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag(BuildMojo.java:56)
    at io.fabric8.maven.plugin.mojo.build.BuildMojo.buildAndTag(BuildMojo.java:235)
    ... 30 more
Caused by: io.fabric8.maven.docker.access.hc.http.HttpRequestException: Get https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0: Get https://auth.docker.io/token?scope=repository%3Ajboss-fuse-6%2Ffis-java-openshift%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) (Internal Server Error: 500)
    at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate$StatusCodeCheckerResponseHandler.handleResponse(ApacheHttpClientDelegate.java:177)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)
    at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.post(ApacheHttpClientDelegate.java:97)
    at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.pullImage(DockerAccessWithHcClient.java:366)
    ... 35 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我按照Redhat站点中给出的说明,使用docker、oc设置本地环境,并通过oc登录从本地机器访问Openshift环境。另外,我对远程运行的openshift环境没有太多的了解,我只得到了openshift控制台和从本地机器连接的令牌。

所以,现在我的问题是

>

如前所述,我不知道fabric8是否安装在openshift平台的顶部。是否必须在openshift上安装fabric8,或者openshift提供了现成的功能。

我检查了openshift控制台,它有“jboss-fuse-6/fis java openshift:2.0”图像流。我是否需要获取openshift平台的docker内部存储库url,是否需要在源代码中的某个地方配置该url?在日志中“https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0“,这是从哪里来的-我似乎在源代码中找不到此配置。fabric8是否自动连接到openshift env的内部docker注册表?

当“mvn fabric8:deploy”运行时,我的理解是“项目在本地编译,本地docker连接到Openshift环境,并将基本映像(在本例中为“jboss-fuse-6/fis java Openshift:2.0”)拉入本地机器,构建最终映像并部署到Openshift环境”。这是正确的还是-是另一个,即springboot jar、docker映像构建在openshift平台内并部署在其他平台上?

我的个人资料在OpenShift中是否也需要访问内部OpenShift注册表来提取docker图像?

有人能澄清疑问并帮助解决这个问题吗?

共有2个答案

吕衡
2023-03-14

mvn包fabric8:构建工作。

                    <registry>registry.access.redhat.com</registry>
                    <authConfig>
                      <username>registry-username</username>
                      <password>registry-password</password>
                    </authConfig>

                </configuration>
罗安和
2023-03-14
  1. 如果您使用OpenShift和Fable8 s2i构建,则不需要本地设置。所有构建和部署都在OpenShift中运行。错误显示OpenShift不能拉jboss-fuse-6/fis-java-openShift: 2.0图像。
  2. AFAIK,OpenShift不提供制造8。
  3. 此映像托管在redhat容器注册表中,而不是官方docker注册表中。换句话说,这个图像位于registry.access.redhat.com/jboss-fuse-6/fis-java-openshift,而不是registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift。你需要启用docker引擎来访问redhat注册表,请参考这个例子。
  4. 如果你运行s2i构建,就不是你想的那样。
  5. 没有必要,无论是s2i构建还是docker构建。
 类似资料:
  • 我尝试使用minikube从本地docker镜像和docker hub部署kubernetes。但两者都不起作用。 方法1:使用保存和加载tar文件,创建了图像,它可用于kubectl。 执行以下命令以创建部署: 从kubectl描述pod命令, 方法2:我将映像推送到我的docker hub存储库(https://hub.docker.com/r/get2arun/elk/tags),然后在终端

  • 有了Docker,我只需要提供Docker_主机和适当的凭据,fabric8插件就可以构建我的容器映像。只要Docker注册表可用,就不需要在生成映像的实际主机上安装Docker相关的基础设施(例如my Bambole agent)。 使用OpenShift,我似乎找不到这样做的方法。相反,我似乎必须在安装了OpenShift的主机上运行maven goals,该主机必须是RedHat Linux

  • 目前,我发现谷歌云构建发生在构建docker图像的时候(不像我想象的那样,它会构建我的图像,然后执行我的图像来完成所有的构建)。那是在这篇文章里 谷歌云构建的快速启动 我有一个Dockerfile现在很简单 我有一个单一的下载和提取下载任何工件(zip文件)从最后的单构建运行构建(只有修改的服务器被构建或依赖于上一个CI构建的变化的服务器被构建,就像下游库可能被更改)。第一行只是列出了我需要在一个

  • 我的站点是使用Gatsby建立的,并持续部署Netlify。我已经两个月没碰过我的盖茨比网站了。因此,当我运行更新、添加新内容和部署时,在Netlify构建上遇到了一个中断错误。 尝试了很多事情,花了太多时间在上面。最初我只使用NPM。在坚持了一段时间之后,我按照一些在线线程的建议,转到了纱线。现在使用yarn得到不同的错误消息,但部署到Netlify仍然没有成功。 这可能是一些愚蠢的简单的事情。

  • 目前,我正试图转换我的常规詹金斯工作与詹金斯在OpenShift工作。目前,我正在检查git,建立一个war文件,将war文件复制到另一个只有dockerfile的目录(当然是相同的工作区)。执行dockerbuild并推送到注册表。 现在,我已经设法遵循Openshift的jenkins示例,我已经设法使用jenkins slave maven pod并用它构建了我的包(WAR)。但当然,我不能

  • 十构建部署 待更新……