vjuranek / docker-build-step-plugin

Other
8 stars 97 forks source link

NullPointerException when trying to use plugin to build an image. #16

Closed scmadmin closed 9 years ago

scmadmin commented 9 years ago

Added a build step to do a docker build. It throws a NPE.

Digging into the code, it looks like dockerClientConfig is null, and only gets set if the build is being done on a docker slave. I'm trying to do the build on jenkins master.

My setup is jenkins on docker, with the docker URL set back to the host. That part seems to work ok.

Docker Build Docker Build : build with tag myproject/nodejsbase at path /var/jenkins_home/workspace/my_build/docker/myproject/nodejsbase ERROR: Build step failed with exception java.lang.NullPointerException: config was not specified at shaded.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:226) at com.github.dockerjava.core.DockerClientImpl.<init>(DockerClientImpl.java:36) at com.github.dockerjava.core.DockerClientImpl.getInstance(DockerClientImpl.java:52) at com.github.dockerjava.core.DockerClientBuilder.getInstance(DockerClientBuilder.java:29) at com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run$1.invoke(DockerBuilderPublisher.java:144) at com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run$1.invoke(DockerBuilderPublisher.java:139) at hudson.FilePath.act(FilePath.java:991) at hudson.FilePath.act(FilePath.java:969) at com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run.buildImage(DockerBuilderPublisher.java:139) at com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run.run(DockerBuilderPublisher.java:89) at com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher.perform(DockerBuilderPublisher.java:180) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:906) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:857) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1744) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) Build step 'Build / Publish Docker Containers' marked build as failure

here is the code where dockerClientConfig does not get set.

https://github.com/jenkinsci/docker-plugin/blob/master/docker-plugin/src/main/java/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher.java#L210

mootezbessifi commented 9 years ago

Hi all, Is there any solution for this issue. i am blocked from yesterday.

ccaspanello commented 9 years ago

I too have the same issue.

astubbs commented 9 years ago

+1

vjuranek commented 9 years ago

Hi all, I'm really very sorry I didn't look on this issue sooner. This is different plugin (docker-build-step plugin not docker plugin). Please file the issue into Jenkins JIRA under Docker component (i.e. here). Thanks and sorry once again.