Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-24071

Docker build step tries to build on master and not slave

    Details

    • Similar Issues:

      Description

      When running a Docker build step create image command on a slave it tries to run it on the master

      21:15:04 Building remotely on pollux (twins) in workspace /var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker
      ...
      21:15:11 FATAL: configured dockerFolder '/var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker/' does no exist.
      21:15:11 java.lang.IllegalArgumentException: configured dockerFolder '/var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker/' does no exist.
      21:15:11 	at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:85)
      21:15:11 	at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:65)
      

      Manually creating the workspace on master, and it goes one step further

      22:52:40 FATAL: configured dockerFolder '/var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker' does not contain a Dockerfile.
      22:52:40 java.lang.IllegalArgumentException: configured dockerFolder '/var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker' does not contain a Dockerfile.
      22:52:40 	at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:91)
      22:52:40 	at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:65)
      

      And creating an empty Dockerfile goes one more step but it keeps trying to build on master and not slave

      22:55:56 FATAL: com.kpelykh.docker.client.DockerException: Dockerfile /var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker/Dockerfile is empty
      22:55:56 java.lang.RuntimeException: com.kpelykh.docker.client.DockerException: Dockerfile /var/lib/jenkins/workspace/oracle-java7/jenkins-slave-docker/Dockerfile is empty
      22:55:56 	at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:142)
      22:55:56 	at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:65)
      

        Attachments

          Issue Links

            Activity

            Hide
            sirkkalap Petri Sirkkala added a comment -

            This is very serious limitation. Running all the databases and test environments on Jenkins master will certainly make the Jenkins very unresponsive. Slaves are a must for any serious heavy use CI/CD. The load must be shared and some priority operations separated to ensure thorough operation. We can not risk deployment operations because a wild running test is breaking the master.

            Show
            sirkkalap Petri Sirkkala added a comment - This is very serious limitation. Running all the databases and test environments on Jenkins master will certainly make the Jenkins very unresponsive. Slaves are a must for any serious heavy use CI/CD. The load must be shared and some priority operations separated to ensure thorough operation. We can not risk deployment operations because a wild running test is breaking the master.
            Hide
            dodiehun David Csakvari added a comment - - edited

            Hi!

            I've created a Pull Request to overcome this limitation:

            https://github.com/jenkinsci/docker-build-step-plugin/pull/51

            It's not feature-complete, but it makes the CreateImageCommand play nicely with slaves. If this solution is acceptable, I'll gladly modify the other Commands as well to work with slaves.

            Thanks,

            David

            Show
            dodiehun David Csakvari added a comment - - edited Hi! I've created a Pull Request to overcome this limitation: https://github.com/jenkinsci/docker-build-step-plugin/pull/51 It's not feature-complete, but it makes the CreateImageCommand  play nicely with slaves. If this solution is acceptable, I'll gladly modify the other Commands as well to work with slaves. Thanks, David
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: David Csakvari
            Path:
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/DockerBuilder.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/DockerPostBuilder.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CommitCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateContainerCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/DockerCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateAndStartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecStartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/KillCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PullImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PushImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveAllCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RestartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/SaveImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartByImageIdCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopAllCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopByImageIdCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/TagImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/util/Resolver.java
            http://jenkins-ci.org/commit/docker-build-step-plugin/30ab1b41697a8509d27469296c61d57110c24f2f
            Log:
            Fix for JENKINS-24071

            Fix for issue that prevents Docker build step to build images on Jenkins
            slaves.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: David Csakvari Path: src/main/java/org/jenkinsci/plugins/dockerbuildstep/DockerBuilder.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/DockerPostBuilder.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CommitCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateContainerCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/DockerCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateAndStartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecStartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/KillCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PullImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PushImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveAllCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RestartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/SaveImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartByImageIdCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopAllCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopByImageIdCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/TagImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/util/Resolver.java http://jenkins-ci.org/commit/docker-build-step-plugin/30ab1b41697a8509d27469296c61d57110c24f2f Log: Fix for JENKINS-24071 Fix for issue that prevents Docker build step to build images on Jenkins slaves.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: David Csakvari
            Path:
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CommitCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateContainerCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/DockerCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateAndStartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecStartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/KillCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PullImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PushImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveAllCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RestartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/SaveImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartByImageIdCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopAllCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopByImageIdCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/TagImageCommand.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/CommitRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/CreateContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/CreateImageRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/ExecCreateRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/ExecStartRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/InspectContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/KillContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/ListContainersRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/PullImageRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/PushImageRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/RemoveContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/RemoveImageRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/RestartContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/SaveImageRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/StartContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/StopContainerRemoteCallable.java
            src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/TagImageRemoteCallable.java
            http://jenkins-ci.org/commit/docker-build-step-plugin/11a0346f0efa34feb09b408be9fa27d7186a3ec7
            Log:
            Fix for JENKINS-24071

            Refactor remaining commands to use Channel so they can work on Jenkins
            slaves.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: David Csakvari Path: src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CommitCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateContainerCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/CreateImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/DockerCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateAndStartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecCreateCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/ExecStartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/KillCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PullImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/PushImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveAllCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RemoveImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/RestartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/SaveImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartByImageIdCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StartCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopAllCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopByImageIdCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/StopCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/TagImageCommand.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/CommitRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/CreateContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/CreateImageRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/ExecCreateRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/ExecStartRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/InspectContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/KillContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/ListContainersRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/PullImageRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/PushImageRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/RemoveContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/RemoveImageRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/RestartContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/SaveImageRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/StartContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/StopContainerRemoteCallable.java src/main/java/org/jenkinsci/plugins/dockerbuildstep/cmd/remote/TagImageRemoteCallable.java http://jenkins-ci.org/commit/docker-build-step-plugin/11a0346f0efa34feb09b408be9fa27d7186a3ec7 Log: Fix for JENKINS-24071 Refactor remaining commands to use Channel so they can work on Jenkins slaves.
            Hide
            vjuranek vjuranek added a comment -

            Done, thanks to David Csakvari!

            Show
            vjuranek vjuranek added a comment - Done, thanks to David Csakvari !

              People

              • Assignee:
                vjuranek vjuranek
                Reporter:
                hackmann Hack Kampbjørn
              • Votes:
                19 Vote for this issue
                Watchers:
                28 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: