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

Declarative pipeline and docker entrypoint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • docker-workflow-plugin
    • None
    • problem occurs on version 1.15 and above of the plugin

      I write a dead simple Dockerfile

      FROM openjdk:8-jdk-alpine
      ENTRYPOINT "java"
      

      I write a dead simple declarative pipeline

      pipeline {
          agent { dockerfile true }
          stages {
              stage('Dead Simple') {
                  steps {
                      checkout scm
                  }
              }
          }
       }

      I get an error.

      I get the same error with 

      pipeline {
          agent { docker { image 'openjdk:8-jdk-alpine' } }
          stages {
              stage('Dead Simple') {
                  steps {
                      checkout scm
                  }
              }
          }
      }

      The error is

      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, as required by official docker images (see https://github.com/docker-library/official-images#consistency for entrypoint consistency requirements).
      Alternatively you can force image entrypoint to be disabled by adding option `--entrypoint=''`.
      

      I cannot pass --entrypoint to the run command, it's jenkins that calls it

      a bit more logs :

      [Pipeline] withDockerContainer
      Jenkins does not seem to be running inside a container
      $ docker run -t -d -u 107:111 -w /var/lib/jenkins/workspace/oh-pr0009-api_master-IFYDNFODANQT2HMWSAOO6P6UKZZUCWSO2LNM2M6G7DUPGPLNH7HA -v /var/lib/jenkins/workspace/oh-pr0009-api_master-IFYDNFODANQT2HMWSAOO6P6UKZZUCWSO2LNM2M6G7DUPGPLNH7HA:/var/lib/jenkins/workspace/oh-pr0009-api_master-IFYDNFODANQT2HMWSAOO6P6UKZZUCWSO2LNM2M6G7DUPGPLNH7HA:rw,z -v /var/lib/jenkins/workspace/oh-pr0009-api_master-IFYDNFODANQT2HMWSAOO6P6UKZZUCWSO2LNM2M6G7DUPGPLNH7HA@tmp:/var/lib/jenkins/workspace/oh-pr0009-api_master-IFYDNFODANQT2HMWSAOO6P6UKZZUCWSO2LNM2M6G7DUPGPLNH7HA@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** 4d6ffe9d9713df374dd2670073b9ea32598df407 cat
      $ docker top 13d063e7996ad4476075baf7586aa3186d0bff08cdbd4c10205327bb6b44c75b -eo pid,comm
      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, as required by official docker images (see https://github.com/docker-library/official-images#consistency for entrypoint consistency requirements).
      Alternatively you can force image entrypoint to be disabled by adding option `--entrypoint=''`.
      

            csanchez Carlos Sanchez
            zougi Frederic Rousseau
            Votes:
            8 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: