-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins 2.73.1, Kubernetes Plugin 1.0, Kubernetes 1.7.4
Attempting to execute sh command within container step fails when the image user is not root.
Replicate by running pipeline:
podTemplate(name: 'my-pod', label: 'my-pod', containers: [ containerTemplate(name: 'kubectl-cmd', image: 'wernight/kubectl:1.6.4', ttyEnabled: true, command: 'cat', args:null)]) { node('my-pod') { stage('Test command') { container('kubectl-cmd') { sh 'whoami' } } } }
`sh 'whoami'` does not successfully run, and the job fails with message: "ERROR: script returned exit code -2 "
The image being run is here.
I created a modified version of the image where simply "User kubectl" is removed. The job then runs as expected.
- duplicates
-
JENKINS-47827 Support passing a user/uid into containerTemplate
- Resolved
- is related to
-
JENKINS-46230 git-lfs not working in kubernetes container
- Closed
-
JENKINS-46055 "dir" fails to use existing directory owned by root
- Open