Gradle和Groovy尝试使用以下任务时有点新鲜:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerPushImage.html
如下:
task pushImageDev(type: DockerPushImage) {
imageName "xxxxxx:5000/${project.name}-${appEnviroment}:${version}"
registryCredentials {
email = 'none@your.business'
url = 'xxxxxx:5000'
username = 'xxxxxx'
password = 'xxxxxx'
}
}
但我一直在......
Could not find method registryCredentials() for arguments [build_21ymvy7kfomjn3daqwpuika10$_run_closure8$_closure18@dd69c19] on task ':pushImageDev' of type com.bmuschko.gradle.docker.tasks.image.DockerPushImage
答案 0 :(得分:1)
我相信您只能在Traceback (most recent call last):
File "demoplayer.py", line 7, in <module>
from pywinauto import application
任务配置中使用registryCredentials
方法,而不能在自定义任务中使用{/ p>
docker
如果要创建自定义任务,可能必须创建要传递的DockerRegistryCredentials的实际实例,例如
docker {
registryCredentials {
url = 'https://gcr.io'
username = '_json_key'
password = file('keyfile.json").text
}
}
原因是task pushImageDev(type: DockerPushImage) {
imageName "xxxxxx:5000/${project.name}-${appEnviroment}:${version}"
registryCredentials(new DockerRegistryCredentials(...));
}
是DockerExtension.groovy中定义的扩展,不适用于自定义任务。它不是类registryCredentials {...}
中字段registryCredentials
的setter。
还可以在自定义任务内的DockerPushImage
调用中嵌套注册表凭据调用,但我不确定原因:
docker