Docker.withRun()命令出错
我正在尝试将用户uid更改为0Docker.withRun()命令出错,docker,jenkins,kubectl,Docker,Jenkins,Kubectl,我正在尝试将用户uid更改为0 docker.image('pahud/eks-kubectl-docker').withRun('-u 0:0').inside.{ withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: awsCredentialsId, accessKey
docker.image('pahud/eks-kubectl-docker').withRun('-u 0:0').inside.{
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: awsCredentialsId,
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']])
{
sh 'AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} AWS_DEFAULT_REGION=us-west-2 CLUSTER_NAME=oeksctl'
sh 'aws eks --region us-west-2 update-kubeconfig --name eksctl'
我得到以下错误
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: static org.jenkinsci.plugins.docker.workflow.Docker.withRun() is applicable for argument types: (java.lang.String) values: [-u 0:0]
Possible solutions: with(groovy.lang.Closure), withTool(java.lang.String, groovy.lang.Closure)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
应该是这样的
docker.image('pahud/eks-kubectl-docker').inside('-u 0:0'){
而不是
docker.image('pahud/eks-kubectl-docker').withRun('-u 0:0').inside{
尝试使用.withRun('-u0:0'){
而不是.withRun('-u0:0')。内部。{