0

I am trying to deploy the sample project using Fabric8 Maven plugin. https://github.com/jbossdemocentral/katacoda-fuse-getting-started.git

I have a up and running Openshift environment in remote machine and I am connecting to it using "oc login ....."

Local Development Machine Setup: has docker, maven. oc installed.

  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

When I run the sample project "mvn fabric8:deploy" from command prompt, the build fails with

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

I followed the instructions given in the Redhat site and setup the local environment with docker, oc and access to Openshift environment from local machine via oc login. Also, I dont have much knowledge on the openshift environment thats running remotely, I got only openshift console and the token with which am connecting from local machine.

So, now the questions I have are

  1. Is there any additional setup required to use fabric8 in Local machine?

  2. As mentioned already, am not aware if fabric8 is installed on top of openshift platform. Is it mandatory to have fabric8 on openshift setup or openshift provides this out of the box.

  3. I checked in openshift console, it has got "jboss-fuse-6/fis-java-openshift:2.0" imagestreams. Do I need to get the docker internal repository url of the openshift platform and should this needs to be configured in the source code somewhere? In logs "https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0", where this comes from - I dont seem to find this configuration in source code. Does fabric8 automatically connects to the Internal docker registry of openshift env?

  4. When the "mvn fabric8:deploy" is run, my understanding is "Project is compiled locally, Local docker connects to the Openshift environment and pulls the base images (in this case 'jboss-fuse-6/fis-java-openshift:2.0') into Local machine and builds the final images and deploys to openshift environment". Is this correct or - is it the other away around i.e, the springboot jar, docker images are built inside openshift platform and deployed too?

  5. Should my profile in openshift also needs to have access to Internal Openshift Registry to pull docker images?

Can someone please clarify the doubts and help with the issue?

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
jack
  • 803
  • 3
  • 15
  • 26

2 Answers2

0
  1. If you use OpenShift and fabric8 s2i build, local setup is not required. All builds and deployments run in OpenShift. The error shows that OpenShift can not pull jboss-fuse-6/fis-java-openshift:2.0 image.
  2. AFAIK, OpenShift doesn't provide fabric8.
  3. This image is hosted in redhat container registry, not official docker registry. In other words, this image is located at registry.access.redhat.com/jboss-fuse-6/fis-java-openshift, not registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift. You need to enable docker engine to access redhat registry, please refer to this for example.
  4. Not the way you think if you are running s2i build.
  5. Not necessary, for either s2i build or docker build.
ccshih
  • 1,190
  • 3
  • 17
  • 25
  • Thanks for the prompt reply. So wrt 2, fabric8 needs to be installed on Openshift? for #3, How is the build trying to reach "https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0"? – jack May 15 '18 at 10:33
  • 1
    if you only use fabric8 maven plugin (fmp) with OpenShift, you don't need additional setup on OpenShift cluster. Fmp co-work with OpenShift through local openshift client tools (`oc`). – ccshih May 17 '18 at 03:24
  • If you don't specify any registry in docker config, docker engine will try to pull image only from `registry-1.docker.io/v2`. – ccshih May 17 '18 at 03:38
-1

mvn package fabric8:build works.

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

                </configuration>
  • Please add more than just a small code snippet as an answer. Please also provide an explanation as to how your code will help with the question originally posed (which, by the way, seems to relate to an error not necessarily solved by the above). – w08r Feb 24 '20 at 21:45