gradle-docker-plugin: 'java.lang.reflect.InvocationTargetException-->null' error on buildImage default build.

I am using the default example for building a docker container

task createDockerfile(type: Dockerfile) {
    destFile = project.file('build/mydockerfile/Dockerfile')
    from 'ubuntu:12.04'
    maintainer 'Benjamin Muschko "benjamin.muschko@gmail.com"'
}

task buildImage(type: DockerBuildImage) {
    dependsOn createDockerfile
    inputDir = createDockerfile.destFile.parentFile
    tag = 'bmuschko/myimage'
}

but I am receiving a

Execution failed for task ':buildImage'.
> java.lang.reflect.InvocationTargetException-->null

error message on the gradle build command. This seems like a bug. I am using gradle 2.11 by the way.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 31

Most upvoted comments

I haven’t been able to reproduce the error with 2.6.4. But after I tried that, I haven’t been able to reproduce it any longer with 2.6.7 either… this is turning into a Heisenbug…

@Teudimundo were you able to move foward? I’m not sure if your issue is directly related to the one at hand. If you are still having troubles please open up another issue addressing your concerns along with a complete stacktrace and example script you are using.

From stacktrace I see that exception is thrown at BuildImageResultCallback.java:69 so I guess there was unexpected response from docker engine. Try to build image using generated Dockerfile with docker CLI:

cd /Users/abalz1/Work/nike/code/notificationeventproc/build/mydockerfile
export DOCKER_HOST=http://192.168.1.1:2375
export DOCKER_CERT_PATH=~/.docker/machine/machines/default
docker --rm -t bmuschko/myimage build .

@st9x3st9 show your build.gradle! Are there any other errors in build output? Show us console log with -i switch. Does your docker engine is up and running? Do you use local or remote engine? Provide some context!