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

          Jesse Glick created issue -
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 63 (Web Link)" [ 14800 ]
          Jesse Glick made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

          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.
          Jesse Glick made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]

          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.

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

              Created:
              Updated:
              Resolved: