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

Image.inside fails for images specifying ENTRYPOINT

      alobato found that inside fails with a cryptic error when trying to run images specifying ENTRYPOINT. For example this causes this to fail, which is confusing since for purposes of using Image.inside it makes no sense to be running copy_reference_files and associated code; the way this image is normally designed to work for command-line execution is inappropriate.

          [JENKINS-37987] Image.inside fails for images specifying ENTRYPOINT

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java
          src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java
          src/test/java/org/jenkinsci/plugins/docker/workflow/client/DockerClientTest.java
          http://jenkins-ci.org/commit/docker-workflow-plugin/5b0586d6bd87fc4f108693ee9361252a24eb37d1
          Log:
          [FIXED JENKINS-37987] Override ENTRYPOINT, not just command, for WithContainerStep.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java src/test/java/org/jenkinsci/plugins/docker/workflow/client/DockerClientTest.java http://jenkins-ci.org/commit/docker-workflow-plugin/5b0586d6bd87fc4f108693ee9361252a24eb37d1 Log: [FIXED JENKINS-37987] Override ENTRYPOINT, not just command, for WithContainerStep.

          This change has caused problems for us. We use images with ENTRYPOINT that run some processes, and then use the inside commands to drive tests against those processes. With this change, our entrypoints are forcibly replaced with cat and our processes don't run. Perhaps the entry point could be configurable for inside? Like it now is for Image.withRun.

          David LaBissoniere added a comment - This change has caused problems for us. We use images with ENTRYPOINT that run some processes, and then use the inside commands to drive tests against those processes. With this change, our entrypoints are forcibly replaced with cat and our processes don't run. Perhaps the entry point could be configurable for inside ? Like it now is for Image.withRun .

          jglick: I agree with labisso and am having trouble using any image now that specifies an ENTRYPOINT in the dockerfile.

          Logan Glickfield added a comment - jglick : I agree with labisso and am having trouble using any image now that specifies an ENTRYPOINT in the dockerfile.

          Sergey Zhemzhitsky added a comment - - edited

          jglick, I completely agree with labisso and lsglick. With this fix now it's hardly possible to use custom images with default entrypoint that is required to run. We had to migrate from

          docker.image(<image>).inside(opts) {
            sh "<command>"
          }
          

          ... with its pretty neat syntax to ugly custom shell scripts

          sh "docker run --rm -t -e ... <image> <command>"
          

          Sergey Zhemzhitsky added a comment - - edited jglick , I completely agree with labisso and lsglick . With this fix now it's hardly possible to use custom images with default entrypoint that is required to run. We had to migrate from docker.image(<image>).inside(opts) { sh "<command>" } ... with its pretty neat syntax to ugly custom shell scripts sh "docker run --rm -t -e ... <image> <command>"

          James Hogarth added a comment - - edited

          It's not much nicer but as a workaround you can do:

          docker.image('<image>').withRun('--') { con ->
                sh "docker exec ${con.id} <command>"
              }
          

          This then has the same behavior as docker.image().inside() as before with ENTRYPOINT being executed (so things like systemd or a similar reaper will run) ...

          There's also JENKINS-26178 of course to be able to exec in a running container which would work around this, if it gets implemented.

          James Hogarth added a comment - - edited It's not much nicer but as a workaround you can do: docker.image( '<image>' ).withRun( '--' ) { con -> sh "docker exec ${con.id} <command>" } This then has the same behavior as docker.image().inside() as before with ENTRYPOINT being executed (so things like systemd or a similar reaper will run) ... There's also JENKINS-26178 of course to be able to exec in a running container which would work around this, if it gets implemented.

          James Hogarth added a comment - - edited

          Reopening to track as it breaks people's workflow ...

          There is a fresh PR to add Image.exec() {} to provide access to am inside() style behaviour without the ENTRYPOINT override

          James Hogarth added a comment - - edited Reopening to track as it breaks people's workflow ... There is a fresh PR to add Image.exec() {} to provide access to am inside() style behaviour without the ENTRYPOINT override

          Jesse Glick added a comment -

          The originally filed issue was fixed with the specified commit. Please do not reopen.

          Jesse Glick added a comment - The originally filed issue was fixed with the specified commit. Please do not reopen.

          Since Jesse is rather terse in his comment, what he really means is that the regression people reported is currently tracked as JENKINS-39748, so if you are affected by this, please follow that issue.

          Kohsuke Kawaguchi added a comment - Since Jesse is rather terse in his comment, what he really means is that the regression people reported is currently tracked as JENKINS-39748 , so if you are affected by this, please follow that issue.

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java
          src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java
          http://jenkins-ci.org/commit/docker-workflow-plugin/8367ac4c170bc822eb24ef94b8afb0de4881d1f6
          Log:
          Revert "[FIXED JENKINS-37987] Override ENTRYPOINT, not just command, for WithContainerStep."

          This reverts commit 5b0586d6bd87fc4f108693ee9361252a24eb37d1.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java http://jenkins-ci.org/commit/docker-workflow-plugin/8367ac4c170bc822eb24ef94b8afb0de4881d1f6 Log: Revert " [FIXED JENKINS-37987] Override ENTRYPOINT, not just command, for WithContainerStep." This reverts commit 5b0586d6bd87fc4f108693ee9361252a24eb37d1.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: