compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose v2.6.0 "A" is not a valid project name

Open trent-abc opened this issue 4 years ago • 11 comments

Description

docker-compose specifying a project name with capital letters fails. This was introduced in the most recent update from v2.5.1 -> v2.6.0. I assume this wasn't intended behaviour since it isn't in the release notes or documentation.

Steps to reproduce the issue:

  1. docker-compose -p "A" -f a.yml build

Describe the results you received: "A" is not a valid project name

Describe the results you expected: stat /var/jenkins/workspace/A/a.yml: no such file or directory

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.6.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 29
  Running: 26
  Paused: 0
  Stopped: 3
 Images: 46
 Server Version: 20.10.4
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 84113eef6fc27af1b01b3181f31bbaf708715301
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.14.225-169.362.amzn2.x86_64
 Operating System: Amazon Linux 2
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 30.8GiB
 Name: ip-10-102-101-107.ca-central-1.compute.internal
 ID: GXAL:GIVM:M4AI:E6IS:JCG4:762F:UQBG:ETHJ:O2ZH:RFDR:RMOI:I4GY
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details: Ubuntu

trent-abc avatar Jun 01 '22 17:06 trent-abc

@trent-abc

Are you able to confirm it works with 2.5.1 ?

I've done some testing on my ends, and results are the same with 2.5.1

~ $ docker compose version
Docker Compose version v2.5.1
~ $ docker compose -f workspace/compose-test-9519/compose.yml -p A up
"A" is not a valid project name
~ $ docker compose version
Docker Compose version v2.6.0
~ $ docker compose -f workspace/compose-test-9519/compose.yml -p A up
"A" is not a valid project name

I'm assuming we were using v1 before ?

maxcleme avatar Jun 02 '22 07:06 maxcleme

I'm having the same issue on a MacBook Pro using Monterey.

whatever778 avatar Jun 07 '22 15:06 whatever778

@maxcleme You're right, I guess. 2.5.1 seems to have the same issue. But...

I was able to confirm 2.0.1 behaves properly

wget https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-linux-x86_64
chmod +x docker-compose-linux-x86_64
./docker-compose-linux-x86_64 -p "A" -f a.yml build
stat /home/ec2-user/h/a.yml: no such file or directory

as well as v2.2.3, and all the way up to [v2.5.0] https://github.com/docker/compose/releases/tag/v2.5.0

So I guess my bug was off by 1 version.

trent-abc avatar Jun 07 '22 16:06 trent-abc

Yes, this behaviour was introduced in this PR and is expected. This issue has some more details regarding why this was implemented.

It also was included the release notes of 2.5.0, here.

laurazard avatar Jun 10 '22 09:06 laurazard

Well, introducing such a breaking change in a feature release seems not that compliant to semantic versioning scheme. But we will be able to handle it I believe ;)

Persi avatar Jun 10 '22 09:06 Persi

If that's the case then the error message should indicate the remedy for clarity:

"A" is not a valid project name.  Uppercase letters are not allowed in project names.

the issue doesn't really explain why the change was made at all. The results he was expecting were from the capitalized compose project name. Clearer error messaging could avoid some of this misunderstanding though as I suggest above. As you can see from the likes on the issue I think more people are confused on the solution/timing of the solution than understand the "fix".

trent-abc avatar Jun 10 '22 16:06 trent-abc

This is a bad change as I have to change project name in my visual studio c#, very inconvenient as I have a few references to it. The whole repository name needs to be changed to fix it. I highly recommend to revert the change

BenoityipMSFT avatar Oct 03 '22 02:10 BenoityipMSFT

@BenoityipMSFT why? You can just add a project_name property on the top level of your Compose file

glours avatar Oct 03 '22 07:10 glours

If someone stumbles onto this issue as I did and was frustrated (as I was) with the advice here, the work around is not to set project_name but to set name. For example your docker-compose.yaml file would start with this:

version: 3.7
name: mynamethatdoesnotviolatetherules

danielquinn avatar Mar 25 '23 21:03 danielquinn

This is a breaking change , as we have tasks generated by gradle docker plugin which follows the camel casing convention in gradle , this worked fine on ubuntu with compose 1.26 - but now breaks on Mac with compose 2.17

shlomiken avatar May 17 '23 14:05 shlomiken

I concur that this is a breaking change. I just updated and suddenly am getting this error, even though I haven't changed a setting in 8 months.

Also, nothing in that change explains "why" this change was made.

DJFriar avatar May 17 '23 16:05 DJFriar