Jenkins docker workflow plugin executes without PATH

967 Views Asked by At

I'm having issues running a shell command in a Docker container with the Jenkins declarative pipeline. using the docker workflow plugin. It seems that it can't find the command 'cat', suggesting a path issue. I have limited the task to a simple task (env shell command) in a very simple image (alpine) and verified that /bin/cat works. What is my mistake/misunderstanding?

Updated: I am including the entire command that Jenkins generates. I didn't add all these extra arguments, for some reason Jenkins seems to inject them outside my control.

$ docker run -t -d -u 496:493 -w /jenkins/workspace/project-pipeline@2 -v /jenkins/workspace/project-pipeline@2:/jenkins/workspace/project-pipeline@2:rw -v /jenkins/workspace/project-pipeline@2@tmp:/jenkins/workspace/project@2@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat alpine
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] End of Pipeline
java.io.IOException: Failed to run image 'alpine'. Error: docker: Error response from daemon: Container command 'cat' not found or does not exist..
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.run(DockerClient.java:125)

And here is my pipeline stage:

stage("test") {
  agent {
    docker {
      image 'alpine'
      label 'docker-enabled'
    }
  }
  steps {
    sh 'env'
  }
}
0

There are 0 best solutions below