npm install fails in jenkins pipeline in docker

前端 未结 12 918
野性不改
野性不改 2020-12-07 17:45

I\'m following a tutorial about Jenkins pipeline and I can get a \"hello world\" working under at node 6.10 docker container.

But, when I added a default EmberJS app

12条回答
  •  伪装坚强ぢ
    2020-12-07 18:12

    I add the same issue. I solved it using the root user to run the Docker image:

    node {
        stage("Prepare environment") {
            checkout scm
            // Build the Docker image from the Dockerfile located at the root of the project
            docker.build("${JOB_NAME}")
        }
    
        stage("Install dependencies") {
            // Run the container as `root` user
            // Note: you can run any official Docker image here
            withDockerContainer(args: "-u root", image: "${JOB_NAME}") {
                sh "npm install"
            }
        }
    }
    

提交回复
热议问题