• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • docker-workflow-plugin
    • None
    • Jenkins Version: 2.121.1
      Docker Pipeline Plugin: 1.5
    • 1.24

      After Upgrading Docker Pipeline Plugin from 1.4 to latest(1.7), our pipeline job running with Docker started failing with following error,
      ERROR: The container started but didn't run the expected command. Please double check your ENTRYPOINT does execute the command passed as docker run argument. See
      https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#entrypoint
      for entrypoint best practices.[Pipeline]

      {[Pipeline] sh[PROMOTION-pre-build-CommitStage@2] Running shell script invalid argument "=" for "-e, --env" flag: invalid environment variable: = See 'docker exec --help'. process apparently never started in /****/workspace/*********@2@tmp/durable-bf8996ec[Pipeline] }

      $ docker stop --time=1 6c3e4c47264e7766c2277555ac05de7267ab0895ab8f91b257761a6c649379c2
      $ docker rm -f 6c3e4c47264e7766c2277555ac05de7267ab0895ab8f91b257761a6c649379c2[Pipeline] // withDockerContainer[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // withDockerRegistry[Pipeline] }[Pipeline] // withCredentials[Pipeline] }[Pipeline] // ws[Pipeline] }[Pipeline] // node[Pipeline] echoError: hudson.AbortException: script returned exit code -2
       

      Investigating further we found that issue is with Docker Pipeline Plugin 1.5.

       

      Can you please help us fix this issue? Are we missing something while using version 1.5 or is it a bug in the plugin?

          [JENKINS-52264] Error while running pipeline job in docker

          Adam added a comment -

          I found help here for a similar issue: http://jenkins-ci.361315.n4.nabble.com/withDockerContainer-in-pipeline-failing-td4932626.html

          Basically, in case the link dies: you likely have an empty environment variable in your global configuration or node configuration.

          Adam added a comment - I found help here for a similar issue: http://jenkins-ci.361315.n4.nabble.com/withDockerContainer-in-pipeline-failing-td4932626.html Basically, in case the link dies: you likely have an empty environment variable in your global configuration or node configuration.

          I had the same issue and it was indeed an empty environment set in the global configuration. There was code added to protect from that in version 1.12 but was done only for docker run and not for docker exec. It is a shame really because the fix is a one line change.

          This commit has the fix for the docker run and the same can be made for the docker exec in the same class.

          https://github.com/jenkinsci/docker-workflow-plugin/commit/a25fe7ad582eecb771292084acdbff5ee56cd2c2

          Alexander Volanis added a comment - I had the same issue and it was indeed an empty environment set in the global configuration. There was code added to protect from that in version 1.12 but was done only for docker run and not for docker exec. It is a shame really because the fix is a one line change. This commit has the fix for the docker run and the same can be made for the docker exec in the same class. https://github.com/jenkinsci/docker-workflow-plugin/commit/a25fe7ad582eecb771292084acdbff5ee56cd2c2

          I created https://github.com/jenkinsci/docker-workflow-plugin/pull/147 which addresses this issue the same way it was done for "docker run" in the original commit mentioned above. Since that original commit was done the "docker exec" was changed to use the "–env" option which exposed this defect.

          Alexander Volanis added a comment - I created https://github.com/jenkinsci/docker-workflow-plugin/pull/147  which addresses this issue the same way it was done for "docker run" in the original commit mentioned above. Since that original commit was done the "docker exec" was changed to use the "–env" option which exposed this defect.

          I was having this same issue and found that if you go Manage Jenkins -> Configure System there will be an empty environment variable in the Global Properties section. If you remove that everything should work

          Jonathan Chauncey added a comment - I was having this same issue and found that if you go Manage Jenkins -> Configure System there will be an empty environment variable in the Global Properties section. If you remove that everything should work

          Giorgio Desideri added a comment - - edited

          In my scripted pipeline -v /var/jenkins/caches:/var/jenkins/caches it works as work-around.

          docker.image("....").inside("{{-v /var/jenkins/caches:/var/jenkins/caches")

          {

          ...

          }

          Giorgio Desideri added a comment - - edited In my scripted pipeline -v /var/jenkins/caches:/var/jenkins/caches it works as work-around. docker.image("....").inside("{{-v /var/jenkins/caches:/var/jenkins/caches ") { ... }

          Tim Black added a comment -

          This can manifest in various ways - for me it first appeared to be this bug, and only after enabling LAUNCH_DIAGNOSTICS did we see evidence that lead us here, which was the actual culprit.

           

           

          Tim Black added a comment - This can manifest in various ways - for me it first appeared to be this bug , and only after enabling LAUNCH_DIAGNOSTICS did we see evidence that lead us here, which was the actual culprit.    

          Carroll Chiou added a comment - - edited

          Carroll Chiou added a comment - - edited PR to address this issue here: https://github.com/jenkinsci/docker-workflow-plugin/pull/219

            carroll Carroll Chiou
            suvir_pavin Suvir Pavin
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: