You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing a project name containing any amount of leading underscores to up command causes those underscores to be silently removed when container names are generated. This is inconsistent with down command, which does not seem to be taking that into account anymore (it did in Docker Compose v1). This breaks some automated tools that depend on Docker Compose, because they are able to create containers by providing such project name, but are unable to stop or remove them due to name mismatch.
Steps to reproduce the issue:
Create docker-compose.yml file with following content
./docker-compose_1.29.2 -p _my-project up -d
./docker-compose_1.29.2 -p _my-project down
./docker-compose_2.5.0 -p _my-project up -d
./docker-compose_2.5.0 -p _my-project down
Describe the results you received:
v1.29.2 correctly removed the container during execution of down command, whereas v2.5.0 failed with an error.
Output of v1.29.2:
up:
Creating network "_my-project_default" with the default driver
Creating my-project_service_1 ... done
I am having them same problem. Project names with period in them used to work in v1.29 but I now get "No container found for project" in v2.5 when executing the down command.
Since the release of Compose v2.5.1 and the version v1.2.5 of compose-go, a project name can't start with _ or contains .
This decision was made to fix potential security issue and if you want to keep your container names as a valid hostname you should avoid using underscore in project or service names
Description
Passing a project name containing any amount of leading underscores to
up
command causes those underscores to be silently removed when container names are generated. This is inconsistent withdown
command, which does not seem to be taking that into account anymore (it did in Docker Compose v1). This breaks some automated tools that depend on Docker Compose, because they are able to create containers by providing such project name, but are unable to stop or remove them due to name mismatch.Steps to reproduce the issue:
Download docker compose v1.29.2:
wget https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64 && mv docker-compose-Linux-x86_64 docker-compose_1.29.2
Download docker compose v2.5.0:
wget https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 && mv docker-compose-linux-x86_64 docker-compose_2.5.0
add exec permissions:
chmod +x docker-compose_*
Run following commands on both versions
Describe the results you received:
v1.29.2 correctly removed the container during execution of
down
command, whereas v2.5.0 failed with an error.Output of v1.29.2:
Output of v2.5.0:
Describe the results you expected:
I expected v2.5.0 to correctly remove the container during execution of
down
command.Additional information you deem important (e.g. issue happens only occasionally):
The same behaviour is present in 2.4.1 so it's not a recent regression. The same issue also applies to
start
,stop
and probably other commands too.Output of
docker compose version
:Output of
docker info
:Additional environment details:
none
The text was updated successfully, but these errors were encountered: