gpt4 book ai didi

docker - Docker .withRun()命令错误

转载 作者:行者123 更新时间:2023-12-02 19:23:33 25 4
gpt4 key购买 nike

我正在尝试将用户的uid更改为0

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{

关于docker - Docker .withRun()命令错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58125447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com