docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.8k stars 5.2k forks source link

Project name validation error is confusing #10512

Open noel-fernandes opened 1 year ago

noel-fernandes commented 1 year ago

Description

Current Behaviour: In one of my projects I have the COMPOSE_PROJECT_NAME set to 'MyCoolProject', up until v2.17.2, this was accepted. With v2.17.3, I get an incomplete error message which is as follows:

"MyCoolProject" is not a valid project name: it must contain only characters from [a-z0-9_-] and start with [a-z0-9]

Accepted Behaviour: Based on this link, it would be more appropriate to include in the message that lower case project names are now mandatory.

Steps To Reproduce

Ensure that Docker with Docker Compose v2.17.3 is installed. Setup a docker-compose file with a .env file where the COMPOSE_PROJECT_NAME is set to 'MyCoolProject' Run docker-compose build You should see the error as follows: "MyCoolProject" is not a valid project name: it must contain only characters from [a-z0-9_-] and start with [a-z0-9]

Compose Version

Docker Compose version v2.17.3

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.3
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.10.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 4
  Running: 1
  Paused: 0
  Stopped: 3
 Images: 8
 Server Version: 23.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 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 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.15.90.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 32
 Total Memory: 15.47GiB
 Name: docker-desktop
 ID: 4ba07e8a-8f46-4d87-a670-4840c7f66658
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

image

enjikaka commented 6 months ago

The verification is also completely broken it seems like. I just got this:

"webclient_webclient_embed_generator_PR_12-6" is not a valid project name: it must contain only characters from [a-z0-9_-] and start with [a-z0-9]

replacing the last dash with an underscore solved it for me... but it cleary says dashes are allowed...

brennenawana commented 1 month ago

@enjikaka pretty sure its the uppercase characters that break validation since the regex doesn't include uppercase.