npm命令在jenkinspipe道中与docker失败

我使用jenkinsCI / CD。 新项目使用node.js和生成在npm安装命令失败(例如使用repo https://github.com/heroku/node-js-sample )。 Jenkinsfile:

node { stage ('stage0') { checkout scm } stage ('stage1') { docker.withServer('tcp://example.com:2376', 'docker-example.com') { docker.image('node').inside { withEnv(['npm_config_cache=npm-cache', 'HOME=.']) { sh 'npm install' } } } } } 

build立输出:

 ... [Pipeline] withDockerContainer Jenkins seems to be running inside container 7c44f010df941b4902daaea63b5fe17bbded5f6fd0413852ff5e4b9be630234f $ docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/node-test --volumes-from 7c44f010df941b4902daaea63b5fe17bbded5f6fd0413852ff5e4b9be630234f -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat node [Pipeline] { [Pipeline] withEnv [Pipeline] { [Pipeline] sh [node-test] Running shell script + npm install [Pipeline] } [Pipeline] // withEnv [Pipeline] } $ docker stop --time=1 35b6590a3c172717f24495e92d36cc73562c883db8b337681c07ceb46f27a36b $ docker rm -f 35b6590a3c172717f24495e92d36cc73562c883db8b337681c07ceb46f27a36b [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // withDockerServer [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code -1 Finished: FAILURE 

我发现类似的问题: npm安装在docker中的jenkinspipe道中失败 ,但添加env的解决scheme不能解决这个问题。 我找不到任何关于理由的信息。 jenkins用户和节点的UID / GID完全相同。 试图从主机跨越npm进程,但对解决scheme没有用处。