I have a Jenkins pipeline that I use for building my application. Actual building of software is done using a container. I just mount the source code to container and run container with a specific command.

My pipeline script:

pipeline {
  agent {label 'myagent'}
  stages {
    stage('Prepare') {
        checkout([$class: 'GitSCM',
        branches: [[name: '*/master']],
        userRemoteConfigs: [[credentialsId: '****', url: "****"]]])
    stage('Build') {
        script {
            sh "docker run --rm -v \$(pwd):/home/appuser/app builder:0.0.1 /bin/bash -c '\" cd /home/appuser/app && cmake . && make \"'"

Here is the command:

docker run --rm -v $(pwd):/home/appuser/app builder:0.0.1 /bin/bash -c "cd /home/appuser/app && cmake . && make "


When I run the Jenkins job I receive an error "/bin/bash: cd /home/appuser/app && cmake . && make : No such file or directory"

However, if I copy the exact command and run it in Slave directly, no problems occur.


Am I doing something wrong?

How can I fix this issue?

  • looks like there's one too many quotations. – Bruce Becker Apr 29 at 8:48
  • @BruceBecker I have tried removing the extra single quote symbols, results are same. I am still getting the error. – raidensan Apr 29 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.