jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-51307] Declarative pipeline and docker entrypoint
- Dominant language
- Java
- Stars
- 527
- Forks
- 422
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
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=''`.
---
Originally reported by
zougi, imported from: Declarative pipeline and docker entrypoint
csanchez
Raw content of original issue
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=''`.
- environment:
problem occurs on version 1.15 and above of the plugin
Contributor guide
Assessment
This issue has not been assessed yet.