invalid tag
NikkyAI opened this issue · comments
when using
services:
test_elasticsearch:
build:
context: .
# adds the icu plugin; we have it in elastic cloud
dockerfile: Dockerfile_elasticsearch
it seems like the tag is created with invalid characters eg. -
invalid tag "a5b81cad74ed57d092b0eac4deb9fecf_formation-graphqlapi_-test_elasticsearch": invalid reference format
one of the issue ended up being that we had a -
in our project name
so i suppose.. please add sanitation to things like these, auto replace invalid characters or such ?
when i changed the rootProject.name
it fixed part of the invalid tag..
now we are just left with
invalid tag "a5b81cad74ed57d092b0eac4deb9fecf_formation_graphqlapi_-test_elasticsearch": invalid reference format
and i cannot mak sense of where docker pulls the extra -
from
i tracked it down to it being from the -p $pn
argument
so i overrode the projectName with setProjectName("formation_graphqlapi_test")
and this fixes things
After a Docker (Desktop for Mac) update I run into the same problem with some integration tests. In the console output with "gradle --info ..." I see the following command:
docker-compose --ansi never -f build/docker/docker-compose.yml -p d25dc457ed21cf35aed1317806ab0871_auth_hal_passthroughs_ build
with the error (same as mentioned above):
invalid tag "d25dc457ed21cf35aed1317806ab0871_auth_hal_passthroughs_-keycloak": invalid reference format
The problem arises from the trailing underscore in the argument of the "-p" flag. The command without this trailing underscore
docker-compose --ansi never -f build/docker/docker-compose.yml -p d25dc457ed21cf35aed1317806ab0871_auth_hal_passthroughs build
runs fine.
Is there any sense in this trailing underscore? Could it be avoided?
I also ran into this problem with Docker Desktop for Mac. The Docker Desktop version is 4.12.0, and docker-compose is v2.10.2
. I was able to work around the invalid tag problem by adding a --compatibility
flag via the plugin configuration:
dockerCompose {
composeAdditionalArgs = ['--compatibility']
}
composeAdditionalArgs = ['--compatibility']
This worked for me as well. Thanks, @williamrandolph
It is a more or less undocumented option of docker-compose, see https://docs.docker.com/engine/reference/commandline/compose/
additional problem i ran into as well.. our project name had a -
in it.. which is a invalid character.. the errors were not very clear on it,
everything works much better when i just setProjectName(...)
This issue shouldn't be closed. You are now forced to define a projectname or use compatibility mode. This should either be fixed in the plugin or be documented as one of the first steps if you want to use this plugin.