gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 15:17:10 27 4
gpt4 key购买 nike

| 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
}
}
}

有什么办法设置环境吗?还是我错过了什么?

最佳答案

没关系。我忘了阅读变更日志。

删除了DockerCreateContainer.env,由DockerCreateContainer.env取代

关于docker - Grails Gradle Docker插件bmuschko.github.io/gradle-docker-plugin/throws无法设置未知属性 'env',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53844811/

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