gradle-docker-compose-plugin
gradle-docker-compose-plugin copied to clipboard
docker-compose project name restrictions - can not set project name
Setup:
id "com.avast.gradle.docker-compose" version "0.16.9"- docker version: 20.10.18
- Docker Compose version v2.10.2
Problem:
It seems like newer versions of docker-compose somewhat restrict the project name (no uppercase characters), see https://github.com/docker/compose/issues/9741. Unfortunately, the project name generated by the gradle-docker-compose-plugin for the following config
dockerCompose {
isRequiredByIntegrationTest 'docker/docker-compose.yml'
}
is 1bd882aa0fc45e9fb48ec8510af6c6d8_xxxxxx_integrationTest (notice the uppercase "T")
Therefore when I run the integration tests I get the following error message:
"1bd882aa0fc45e9fb48ec8510af6c6d8_xxxxxx_integrationTest" is not a valid project name.
Therefore, I would suggest this you to not generate project names with uppercase characters as a fix!
Other than that I tried to set the project name manually, like
dockerCompose {
projectName 'lowercase-only'
isRequiredByIntegrationTest 'docker/docker-compose.yml'
}
However this seems to have no effect at all! How can I set the project name correctly? Or why is it not working like that?
The lowercase only policy was introduced in docker-compose version 2.5.0, see https://docs.docker.com/compose/release-notes/#250.