How to mount Jenkins workspace in docker container using Jenkins pipeline

前端 未结 4 1080
攒了一身酷
攒了一身酷 2020-12-13 20:34

I\'m using Jenkins in docker. The /var/jenkins_home is mounted on /var/jenkins-data on my host. My Jenkins can execute docker commands (mount of so

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 21:20

    Thanks, the Previous solution works for me. My version for node container and ${PWD} as param

    stage('Build Solution') { 
            agent {
                docker {
                    image 'node:6-alpine'
                    args '-v ${PWD}:/usr/src/app -w /usr/src/app'
                    reuseNode true
                }
            }
            steps {
                sh 'npm install'
            }
        }
    

提交回复
热议问题