问题一
Jenkins中没有root权限报错
解决办法
创建容器时候添加参数-uroot
docker run -d -p 18080:8080 -p 50000:50000 -uroot -v /var/run/docker.sock:/var/run/docker.sock -v /data/jenkins_home:/var/jenkins_home -v /etc/localtime:/etc/localtime --name jenkins jenkins/jenkins
问题二
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/bin/java" (in directory "/var/jenkins_home/workspace/xxxxxx"): error=2, No such file or directory
/bin中找不到java
解决办法
使用which java
查找java安装位置
root@1c8c3bb5fb5c:/# which java
/opt/java/openjdk/bin/java
添加软链接
ln -s /opt/java/openjdk/bin/java /bin/java
再次构建项目成功