java.lang.RuntimeException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Set "path to docker context" field to "." and set "Dockerfile" field to "Dockerfile" and try a build, and get: {{Build Docker image from ./Dockerfile ... $ docker build --tag 6ae96f119c2701896c3890ff49f07078bcdcac37 --file Dockerfile /home/jenkins/workspace/cloud-acceptance unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/jenkins/Dockerfile: no such file or directory [ssh-agent] Stopped. FATAL: Failed to build docker image from project Dockerfile java.lang.RuntimeException: Failed to build docker image from project Dockerfile at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:127) at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:167) at hudson.model.Build$BuildExecution.doRun(Build.java:156) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) }} If I set "Dockerfile" field to "/home/jenkins/workspace/cloud-acceptance/Dockerfile" it builds without a problem. Either the build command needs to be run in the project workspace directory or the full path to the Dockerfile should be passed to the build command. Alternatively, docs should just clarify that the full path is needed and default to something useful (is there a variable that can be used in this field that contains the project workspace directory?)
    via by John Leach,
  • Set "path to docker context" field to "." and set "Dockerfile" field to "Dockerfile" and try a build, and get: {{Build Docker image from ./Dockerfile ... $ docker build --tag 6ae96f119c2701896c3890ff49f07078bcdcac37 --file Dockerfile /home/jenkins/workspace/cloud-acceptance unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/jenkins/Dockerfile: no such file or directory [ssh-agent] Stopped. FATAL: Failed to build docker image from project Dockerfile java.lang.RuntimeException: Failed to build docker image from project Dockerfile at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:127) at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:167) at hudson.model.Build$BuildExecution.doRun(Build.java:156) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) }} If I set "Dockerfile" field to "/home/jenkins/workspace/cloud-acceptance/Dockerfile" it builds without a problem. Either the build command needs to be run in the project workspace directory or the full path to the Dockerfile should be passed to the build command. Alternatively, docs should just clarify that the full path is needed and default to something useful (is there a variable that can be used in this field that contains the project workspace directory?)
    via by John Leach,
  • I'm using Multi-configuration variables in the Dockerfile parameter box (Dockerfile.$ubuntu_release.$jdk in this example). They are used correctly in the error output but not in the actual docker build command, so the build fails: {{Build Docker image from ./Dockerfile ... $ docker build --tag 6e06fb3a96de83181451f73a093d1313f340d7f5 --file Dockerfile.$ubuntu_release.$jdk /home/core/jenkins/workspace/project/jdk/oraclejdk7/label/docker/ubuntu_release/lucid The Dockerfile (Dockerfile.lucid.oraclejdk7) must be within the build context (/home/core/jenkins/workspace/project/jdk/oraclejdk7/label/docker/ubuntu_release/lucid) FATAL: Failed to build docker image from project Dockerfile java.lang.RuntimeException: Failed to build docker image from project Dockerfile at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:121) at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:152) at hudson.model.Build$BuildExecution.doRun(Build.java:156) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1741) at hudson.matrix.MatrixRun.run(MatrixRun.java:146) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:408) Notifying upstream projects of job completion Finished: FAILURE}}
    via by John Leach,
  • I'm using Multi-configuration variables in the Dockerfile parameter box (Dockerfile.$ubuntu_release.$jdk in this example). They are used correctly in the error output but not in the actual docker build command, so the build fails: {{Build Docker image from ./Dockerfile ... $ docker build --tag 6e06fb3a96de83181451f73a093d1313f340d7f5 --file Dockerfile.$ubuntu_release.$jdk /home/core/jenkins/workspace/project/jdk/oraclejdk7/label/docker/ubuntu_release/lucid The Dockerfile (Dockerfile.lucid.oraclejdk7) must be within the build context (/home/core/jenkins/workspace/project/jdk/oraclejdk7/label/docker/ubuntu_release/lucid) FATAL: Failed to build docker image from project Dockerfile java.lang.RuntimeException: Failed to build docker image from project Dockerfile at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:121) at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:152) at hudson.model.Build$BuildExecution.doRun(Build.java:156) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1741) at hudson.matrix.MatrixRun.run(MatrixRun.java:146) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:408) Notifying upstream projects of job completion Finished: FAILURE}}
    via by John Leach,
  • in https://github.com/jenkinsci/docker-custom-build-environment-plugin/blob/docker-custom-build-environment-1.6.0/src/main/java/com/cloudbees/jenkins/plugins/docker_build_env/Docker.java#L192, the {{getDocker0Ip}} method is using {{ifconfig docker0}} but the result cannot be used in https://github.com/jenkinsci/docker-custom-build-environment-plugin/blob/docker-custom-build-environment-1.6.0/src/main/java/com/cloudbees/jenkins/plugins/docker_build_env/Docker.java#L164 for the docker command {{--add-host}} parameter. {noformat} $ ifconfig docker0 invalid value "dockerhost:flags=4099<UP,BROADCAST,MULTICAST>" for flag --add-host: invalid IP address in add-host: "flags=4099<UP,BROADCAST,MULTICAST>" See 'docker run --help'. FATAL: Failed to run docker image java.lang.RuntimeException: Failed to run docker image at com.cloudbees.jenkins.plugins.docker_build_env.Docker.runDetached(Docker.java:186) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.startBuildContainer(DockerBuildWrapper.java:176) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:151) at hudson.model.Build$BuildExecution.doRun(Build.java:154) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) Finished: FAILURE {noformat}
    via by Adrien Lecharpentier,
    • java.lang.RuntimeException: Failed to build docker image from project Dockerfile at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:127) at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41) at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:167) at hudson.model.Build$BuildExecution.doRun(Build.java:156) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410)
    No Bugmate found.