Grails Gradle Docker 插件 bmuschko.github.io/gradle-docker-plugin/ 抛出 无法设置未知属性'env'


| Error Error initializing classpath: Could not set unknown property 'env' for task ':createPostgresContainer' of type com.bmuschko.gradle.docker.tasks.container.DockerCreateContainer. (Use --stacktrace to see the full trace)

https://bmuschko.github.io/gradle-docker-plugin/

我使用这个Gradle Docker插件设置了一个Postgres Docker容器,通过下面的例子在Mac上测试一些与数据库相关的东西。http://guides.grails.org/grails-docker-external-services/guide/index.html

但它似乎不起作用,因为env字符串不能这样设置:

task createPostgresContainer(type: DockerCreateContainer, dependsOn: pullPostgresImage) {
group = "docker"
ext {
pgContainerName = "demo-db"
dbName = "demo-db"
dbPort = 5432
dbPassword = "kevintan"
}
description = 'Creates PostgreSQL container'
containerName = pgContainerName
imageId = pullPostgresImage.imageName+":"+pullPostgresImage.tag
portBindings = ["${dbPort}:5432"]
env = [
"POSTGRES_PASSWORD=${dbPassword}",
"POSTGRES_DB=${dbName}",
] as String[]
onError { e ->
if (e.class.simpleName in ['BadRequestException', 'ConflictException']) {
logger.warn 'Container already exists'
} else {
throw e
}
}
}

有什么方法可以设置env吗?还是我错过了什么?

没关系。我忘了看变更日志。

删除了DockerCreateContainer.env,取而代之的是DockerCreateContainer.envVars

相关内容

  • 没有找到相关文章

最新更新