Mount folder from host to container when using Docker agent

Viewed 14

I have this Declarative pipeline parallel script:

stage("Generate files") {
                agent {
                    docker {
                        label "${RUNNING_NODE}"
                        image "img_X"
                        reuseNode true
                    }
                } 
                steps {
                        script {
                            sh '''
                            pwd
                            ls
                            docker run -v /var/jenkins_home:/var/jenkins_home
                            ls ''' 
                        } 
                }  
}

I want to mount folders to my container multiple times. I've tried reuseNode but it only mounts only once when we declare stage. And when I tried docker run command, it returns error "Docker: command not found". For several reasons, (like some of my files only created in another stage), I have to use Docker agent. Please help if u have any solution, thank in advance!

0 Answers
Related