Jenkins and 'Cannot connect to the Docker daemon. Is the docker daemon running on this host?' error

1,943 views
Skip to first unread message

kurr...@gmail.com

unread,
Jan 27, 2017, 2:26:41 PM1/27/17
to fabric8
Hello

While also trying to deploy using maven, we have upgraded OpenShift which means the issue that we were previously facing - that being that Jenkins slave could not mount a volume - is resolved.

So I'm trying again with Jenkins.

Our build ends with this error. I have googled this error and there are also sorts of responses. I suspect most do not apply, as we are running inside Kubernetes. 

Running on a single node, skipping docker push as not needed
[Pipeline] readMavenPom
[Pipeline] sh
[shiftwork-staffservice-pipeline-dev] Running shell script
Executing shell script inside container [maven] of pod [kubernetes-801ab98e899c4a3588e4a60e0a537d35-1bf1a31b345e]
Executing command: sh -c echo $$ > '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-0f1f3e3e/pid'; jsc=durable-19bb5cf05acf4899f6be160827bdb56a; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-0f1f3e3e/script.sh' > '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-0f1f3e3e/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-0f1f3e3e/jenkins-result.txt' 
 [?1034hsh-4.2# cd /home/jenkins/workspace/shiftwork-staffservice-pipeline-dev
sh-4.2# sh -c echo $$ > '/home/jenkins/workspace/shiftwork-staffservice-pipeline 
-dev@tmp/durable-0f1f3e3e/pid'; jsc=durable-19bb5cf05acf4899f6be160827bdb56a; JE 
NKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/shiftwork-staffservice-pipelin 
e-dev@tmp/durable-0f1f3e3e/script.sh' > '/home/jenkins/workspace/shiftwork-staff 
service-pipeline-dev@tmp/durable-0f1f3e3e/jenkins-log.txt' 2>&1; echo $? > '/hom 
e/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-0f1f3e3e/jen 
kins-result.txt' 
sh-4.2# exit
exit
+ docker tag staffrostering/shiftwork:1.0.34 172.30.254.212:80/staffrostering/shiftwork:1.0.34
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE


I know I've been asking for a lot of help from y'all. And your help is greatly appreciated.

James Rawlings

unread,
Jan 27, 2017, 3:28:32 PM1/27/17
to kurr...@gmail.com, fab...@googlegroups.com
Are you using a recent version of fabric8?  fabric8 maven plugin inside the Jenkins pipelines should automatically defer to openshift to perform builds so it shouldn't be trying to perform a docker tag.  FWIW the code is here https://github.com/fabric8io/fabric8-pipeline-library/blob/master/vars/mavenCanaryRelease.groovy#L25-L27

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anton

unread,
Jan 27, 2017, 3:32:36 PM1/27/17
to James Rawlings, fabric8
HI James 

Yes we have migrated to the new f.m.p.

To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.

Anton

unread,
Jan 27, 2017, 5:02:42 PM1/27/17
to James Rawlings, fabric8
Hi James

I tried added the highlighted code - here is my Jenkinsfile:

#!/usr/bin/groovy

def failIfNoTests = ""
try {
  failIfNoTests = ITEST_FAIL_IF_NO_TEST
} catch (Throwable e) {
  failIfNoTests = "false"
}

def localItestPattern = ""
try {
  localItestPattern = ITEST_PATTERN
} catch (Throwable e) {
  localItestPattern = "*KT"
}


def versionPrefix = ""
try {
  versionPrefix = VERSION_PREFIX
} catch (Throwable e) {
  versionPrefix = "1.0"
}

def canaryVersion = "${versionPrefix}.${env.BUILD_NUMBER}"
def utils = new io.fabric8.Utils()
def label = "buildpod.${env.JOB_NAME}.${env.BUILD_NUMBER}".replace('-', '_').replace('/', '_')

mavenNode{
  def envStage = utils.environmentNamespace('shiftwork-dev')


  echo 'NOTE: running pipelines for the first time will take longer as build and base docker images are pulled onto the node'
  container(name: 'maven') {

    stage 'Build Release'
    mavenCanaryRelease {
      version = canaryVersion
      sh "mvn fabric8:push -Ddocker.push.registry=${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}"
    }

  }
}

 But now when I run the Jenkins job it errors with:

java.lang.NullPointerException: Cannot get property 'FABRIC8_DOCKER_REGISTRY_SERVICE_HOST' on null object


kurr...@gmail.com

unread,
Jan 27, 2017, 5:48:08 PM1/27/17
to fabric8
As the env var was not set, and I wasnt sure where to set it, I just hard coded it.

      sh "mvn fabric8:push -Ddocker.push.registry=fabric8-docker-registry.default.openshift.mydomain.co"



This allowed the build to progress, but then I get this error:

[INFO] F8> Running generator spring-boot
[WARNING] F8> None of the resolved images [%g/%a:%t] match the docker.image filter 'shiftwork/shiftwork:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:44 min
[INFO] Finished at: 2017-01-27T22:46:59+00:00
sh-4.2# exit
exit
[INFO] Final Memory: 40M/425M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.49:push (default-cli) on project shiftwork: Execution default-cli of goal io.fabric8:fabric8-maven-plugin:3.1.49:push failed: No <dockerHost> or <machine> given, no DOCKER_HOST environment variable, and no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.49:push (default-cli) on project shiftwork: Execution default-cli of goal io.fabric8:fabric8-maven-plugin:3.1.49:push failed: No <dockerHost> or <machine> given, no DOCKER_HOST environment variable, and no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine'
	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.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.PluginExecutionException: Execution default-cli of goal io.fabric8:fabric8-maven-plugin:3.1.49:push failed: No <dockerHost> or <machine> given, no DOCKER_HOST environment variable, and no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine'
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: java.lang.IllegalArgumentException: No <dockerHost> or <machine> given, no DOCKER_HOST environment variable, and no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine'
	at io.fabric8.maven.docker.access.DockerConnectionDetector.extractUrl(DockerConnectionDetector.java:65)
	at io.fabric8.maven.docker.AbstractDockerMojo.createDockerAccess(AbstractDockerMojo.java:277)
	at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:194)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/PluginExecutionException

kurr...@gmail.com

unread,
Jan 27, 2017, 5:52:05 PM1/27/17
to fabric8
I also tried

      sh "mvn fabric8:push -Ddocker.push.registry=tcp://fabric8-docker-registry.default.openshift.mydomain.co:2376 -e"


But got the same error as above. 

kurr...@gmail.com

unread,
Jan 27, 2017, 6:14:10 PM1/27/17
to fabric8
I also tried:
<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.14.2</version>
                <configuration>
                <dockerHost>https://localhost:2376</dockerHost>

But got the same result.

Roland Huss

unread,
Jan 27, 2017, 6:16:21 PM1/27/17
to kurr...@gmail.com, fabric8
As said in another post, this configuration is irrelevant as it refers to the docker-maven-plugin which is not used at all. You should post the configuration of your fabric8-maven-plugin configuration.

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
... roland

kurr...@gmail.com

unread,
Jan 27, 2017, 6:28:39 PM1/27/17
to fabric8, kurr...@gmail.com

Here is the f.m.p config:

<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.14.2</version>
                <configuration>
                <dockerHost>https://fabric8-docker-registry.default.openshift.mydomain.co:2376</dockerHost>
                    <images>
                        <image>
                            <name>${docker.image}</name>
                            <build>
                                <from>${docker.from}</from>
                                <assembly>
                                    <basedir>/app</basedir>
                                    <descriptorRef>${docker.assemblyDescriptorRef}</descriptorRef>
                                </assembly>
                                <ports>
                                    <port>8080</port>
                                </ports>
                                <cmd>
                                    <shell>java -jar /app/${project.artifactId}-${project.version}.war --spring.profiles.active=prod</shell>
                                </cmd>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>



This looks supsicious. 
$ gofabric8 routes
             ▄▄▄▄▄▄▄         
             ███████         
     ▄▄▄▄▄▄▄ ▄▄▄▄▄▄█         
     ███████ ▀▀▀▀▀▀▀ ▄▄▄▄▄▄  
     ▄▄▄▄▄▄▄         ██████  
   ▄▄▄▄▄             ▄▄▄▄▄▄  
   ▀▄▄▄▄▄      ▄▄▄       ▄▄▄ 
    ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▀
      ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▄▄▀ 
        ▀▀▄█▄▄▄▄▄▄▄▄▄▄▄▄▄▀   
          ▄█▄▄▄█▄▄▄█▄▄▄      
          ▄█▄▄▄▄▄▄▄▄▄▄▄      
           ▄▄█▄▄▄▄▄▄▄▄       
            ▄▄▄▄▀▀▄█▄        
         ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄     
         ▀▀▀▀▀▀▀▀▀▀▀▀▀▀      
Setting up routes on your OpenShift installation at https://openshift.mydomain.co:8443 in namespace default

Failed to create the route docker-registry with error Route "docker-registry" is invalid: spec.host: Invalid value: "docker-registry.": host must conform to DNS 952 subdomain conventionsCreate Routes.................................................................✘ Route "docker-registry" is invalid: spec.host: Invalid value: "docker-registry.": host must conform to DNS 952 subdomain conventions



kurr...@gmail.com

unread,
Jan 27, 2017, 6:53:33 PM1/27/17
to fabric8
Sorry, my mistake

Here is the corrected config
<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <version>3.1.49</version>
                <configuration>
                <dockerHost>tcp://fabric8-docker-registry.default.openshift.mydomain.co:2376</dockerHost>
                </configuration>

Updated error

Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot create docker access object 
	at io.fabric8.maven.docker.AbstractDockerMojo.createDockerAccess(AbstractDockerMojo.java:292)
	at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:194)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Cannot extract API version from server https://fabric8-docker-registry.default.openshift.hughestech.co:2376
	at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getServerApiVersion(DockerAccessWithHcClient.java:129)
	at io.fabric8.maven.docker.AbstractDockerMojo.createDockerAccess(AbstractDockerMojo.java:285)
	... 23 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to fabric8-docker-registry.default.openshift.hughestech.co:2376 [fabric8-docker-registry.default.openshift.hughestech.co/176.9.36.15] failed: Connection refused
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220)
	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.get(ApacheHttpClientDelegate.java:67)
	at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getServerApiVersion(DockerAccessWithHcClient.java:125)
	... 24 more
Caused by: java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.jav

kurr...@gmail.com

unread,
Jan 27, 2017, 7:04:44 PM1/27/17
to fabric8
This time I used a different port:

<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <version>3.1.49</version>
                <configuration>
                <dockerHost>tcp://fabric8-docker-registry.default.openshift.mydomain.co:2375</dockerHost>
                </configuration>

Updated error
Still getting 'Cannot connect to the Docker daemon. Is the docker daemon running on this host'

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:21 min
[INFO] Finished at: 2017-01-27T23:58:16+00:00
[INFO] Final Memory: 83M/1113M
[INFO] ------------------------------------------------------------------------
sh-4.2# exit
exit
[Pipeline] fileExists
[Pipeline] echo
Warning OpenShift YAML target/classes/META-INF/fabric8/openshift.yml does not exist!
[Pipeline] echo
s2i mode: false
[Pipeline] echo
Running on a single node, skipping docker push as not needed
[Pipeline] readMavenPom
[Pipeline] sh
[shiftwork-staffservice-pipeline-dev] Running shell script
Executing shell script inside container [maven] of pod [kubernetes-c68d6899f2fb436488e4ef4d17cf5a8f-2f24ad78c136]
Executing command: sh -c echo $$ > '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-617d78f5/pid'; jsc=durable-19bb5cf05acf4899f6be160827bdb56a; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-617d78f5/script.sh' > '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-617d78f5/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-617d78f5/jenkins-result.txt' 
 [?1034hsh-4.2# cd /home/jenkins/workspace/shiftwork-staffservice-pipeline-dev
sh-4.2# sh -c echo $$ > '/home/jenkins/workspace/shiftwork-staffservice-pipeline 
-dev@tmp/durable-617d78f5/pid'; jsc=durable-19bb5cf05acf4899f6be160827bdb56a; JE 
NKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/shiftwork-staffservice-pipelin 
e-dev@tmp/durable-617d78f5/script.sh' > '/home/jenkins/workspace/shiftwork-staff 
service-pipeline-dev@tmp/durable-617d78f5/jenkins-log.txt' 2>&1; echo $? > '/hom 
e/jenkins/workspace/shiftwork-staffservice-pipeline-dev@tmp/durable-617d78f5/jen 
kins-result.txt' 
+ docker tag staffrostering/shiftwork:1.0.53 172.30.254.212:80/staffrostering/shiftwork:1.0.53
sh-4.2# exit
exit
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

James Rawlings

unread,
Jan 28, 2017, 4:00:07 AM1/28/17
to Anton, fab...@googlegroups.com
Anton the code you pasted below I'm afraid doesn't have the code I highlighted.  

The important line is the 'if' statement which avoids those lines if it's not s2iMode.  As you are on OpenShift the pipeline and f-m-p will default to use openshift's binary source strategy which will build and push the image to the openshift registry.  i.e. there is no need to perform any 'docker build', 'docker tag' or 'mvn fabric8:push' commands in your Jenkinsfile.  


Looking at your Jenkinsfile it's looks like you're trying to manually push the image.  Using the original mavenCanaryRelease as in https://github.com/fabric8io/fabric8-jenkinsfile-library/blob/master/maven/CanaryReleaseStageAndApprovePromote/Jenkinsfile should be all you need.

stage 'Build Release'
mavenCanaryRelease {
  version = canaryVersion
}

Can you check your jenkins console output and search for the string 's2i mode:' please?  This corresponds to this line https://github.com/fabric8io/fabric8-pipeline-library/blob/master/vars/mavenCanaryRelease.groovy#L16 and should indicate that openshift was used to build and push your application.  

James Rawlings

unread,
Jan 28, 2017, 4:15:49 AM1/28/17
to Anton, fab...@googlegroups.com
If you still hit an error can you please add a gist containing your jenkinsfile and the output from your jenkins job, perhaps a search and replace changing any company name or information you don't wish to share.  I would like to understand the full picture and if even recreate the problem using a test java app here.

kurr...@gmail.com

unread,
Jan 28, 2017, 4:21:34 AM1/28/17
to fabric8, kurr...@gmail.com
Looking at your Jenkinsfile it's looks like you're trying to manually push the image.  Using the original mavenCanaryRelease as in https://github.com/fabric8io/fabric8-jenkinsfile-library/blob/master/maven/CanaryReleaseStageAndApprovePromote/Jenkinsfile should be all you need.

So I used exactly this jenkinsfile, only modifying the git url.

And get exactly the same error:

+ docker tag staffrostering/shiftwork:1.0.61 172.30.254.212:80/staffrostering/shiftwork:1.0.61 

kurr...@gmail.com

unread,
Jan 28, 2017, 4:27:43 AM1/28/17
to fabric8, kurr...@gmail.com

James Rawlings

unread,
Jan 28, 2017, 4:31:36 AM1/28/17
to kurr...@gmail.com, fab...@googlegroups.com
So I used exactly this jenkinsfile, only modifying the git url.
The jenkinsfile snippet you added to this thread was ..

    stage 'Build Release'
    mavenCanaryRelease {
      version = canaryVersion
      sh "mvn fabric8:push -Ddocker.push.registry=${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}"
    }

Which is not the exact Jenkinsfile, it has an extra mvn fabric8:push in it.

That aside my original statement still stands, the pipeline should not try and tag the image if you're running on openshift so perhaps the logic to work out if openshifts binary source was used to build your java application isn't working as expected as that would cause the error 'Cannot connect to the Docker daemon'  https://github.com/fabric8io/fabric8-pipeline-library/blob/master/vars/mavenCanaryRelease.groovy#L25-L27



--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.

James Rawlings

unread,
Jan 28, 2017, 4:36:23 AM1/28/17
to kurr...@gmail.com, fab...@googlegroups.com
Ok this is useful and we can see that the pipeline believes that openshift didn't build your image https://gist.github.com/magick93/213441a41501e8237be256eb1fe23341#file-jenkins-output-L4306-L4308

Can you gist your fabric8-maven-plugin pom configuration for your application please?  I wonder if there's something odd there that means the image and openshift resources aren't being generated.

When you run `mvn fabric8:build` on your java project from outside fabric8 and jenkins do you see this file generated?

target/classes/META-INF/fabric8/openshift.yml

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.

Anton

unread,
Jan 28, 2017, 4:45:45 AM1/28/17
to James Rawlings, fab...@googlegroups.com
On Sat, Jan 28, 2017 at 10:36 AM, James Rawlings <rawli...@gmail.com> wrote:
Can you gist your fabric8-maven-plugin pom configuration for your application please?  I wonder if there's something odd there that means the image and openshift resources aren't being generated.

I have tried several variations of the below config. 
I created a new route, and now hardcode the image name, which is ignored.

<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <version>3.1.49</version>
                <configuration>
                <dockerHost>tcp://f8registry.openshift.mydomain.co:2375</dockerHost> 
                <image>shiftwork/staffservice:latest</image>
               
               
                </configuration>
                <!--<executions>
                    <execution>
                        <id>json</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>json</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>attach</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach</goal>
                        </goals>
                    </execution>
                </executions>-->
            </plugin>
 

When you run `mvn fabric8:build` on your java project from outside fabric8 and jenkins do you see this file generated?

target/classes/META-INF/fabric8/openshift.yml

I now get:
$ mvn fabric8:build
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building shiftwork 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> fabric8-maven-plugin:3.1.49:build (default-cli) > initialize @ shiftwork >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-versions) @ shiftwork ---
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.6.201602180812:prepare-agent (pre-unit-tests) @ shiftwork ---
[INFO] surefireArgLine set to -javaagent:/home/anton/.m2/repository/org/jacoco/org.jacoco.agent/0.7.6.201602180812/org.jacoco.agent-0.7.6.201602180812-runtime.jar=destfile=/home/anton/git/gitlab/staffservice/target/test-results/coverage/jacoco/jacoco.exec
[INFO] 
[INFO] <<< fabric8-maven-plugin:3.1.49:build (default-cli) < initialize @ shiftwork <<<
[INFO] 
[INFO] --- fabric8-maven-plugin:3.1.49:build (default-cli) @ shiftwork ---
[INFO] F8> Running in Kubernetes mode
[INFO] F8> Running generator spring-boot
[INFO] F8> Running generator java-exec
[WARNING] F8> None of the resolved images [%g/%a:%t] match the docker.image filter 'shiftwork/staffservice:latest
[ERROR] F8> Cannot create docker access object 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.509 s
[INFO] Finished at: 2017-01-28T10:44:19+01:00
[INFO] Final Memory: 38M/340M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.49:build (default-cli) on project shiftwork: Cannot create docker access object: Process 'gofabric8 docker-env' exited with status 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
anton@anton-K93SV:~/git/gitlab/staffservice$ 
 


James Rawlings

unread,
Jan 28, 2017, 4:45:57 AM1/28/17
to kurr...@gmail.com, fab...@googlegroups.com
We have quite a few quickstarts that might be useful, for example this is a springboot webmvc java application we use.  Here is the fabric8-maven-plugin configuration https://github.com/fabric8-quickstarts/spring-boot-webmvc/blob/master/pom.xml#L136-L148

I'm not able to be around much more of this weekend but if you are able to have fabric8-maven-plugin building the docker image for your application and generating the openshift.yml file under ./target/classes/META-INF/fabric8/ then the pipeline should us this and decide to not perform the docker tag commands.

I've raised an issue to have better logging and error handling in the pipelines if no openshift or kubernetes resources are found https://github.com/fabric8io/fabric8-pipeline-library/issues/63
Reply all
Reply to author
Forward
0 new messages