compose: [BUG] docker-compose 2.17.1 changes syntex limitation - will not accept stack names with a '.'

Description

Regression from previous version (2.17) - a stack name which includes a ‘.’ symbol is now considered illegal:

Example: $ docker-compose ps “lokal.co.il” is not a valid project name: it must contain only characters from [a-z0-9_-] and start with [a-z0-9]

Steps To Reproduce

Have a working (on previous versions) stack with a name in it: mkdir domain.co.il cd domain.co.il cat << EOF > docker-compose.yaml version: ‘3’

volumes: domain_html:

networks: web_internal:

services: domain.co.il: image: nginx:alpine restart: always volumes: - lokal_html:/usr/share/nginx/html:ro environment: - VIRTUAL_HOST=domain.co.il - VIRTUAL_PORT=80 - VIRTUAL_NETWORK=web_internal networks: - web_internal logging: driver: “json-file” options: max-size: “30m” max-file: “3” EOF

docker-compose ps (fails) docker-compose-v2.17 ps # Returns results

Compose Version

No response

Docker Environment

Docker Compose version v2.17.1

Worked correctly on:
Docker Compose version v2.17.0

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@milas: FWIW, I’m coming across this same issue (our project names have periods) in Docker Desktop v4.18.0 which included Docker Compose v2.17.2:

C:\>docker-compose  -f "C:\[...]\docker-compose.yml" -f "C:\[...]\docker-compose.override.yml" -p dockercompose5310333527275421019 --ansi never --profile "*" config
name Does not match pattern '^[a-z0-9][a-z0-9_-]*$'

C:\>docker-compose version
Docker Compose version v2.17.2

The logic checks out: a project name with periods in the name doesn’t match that RegexPattern. Downgraded to Docker Desktop 4.17.0 with Docker Compose v2.15.1 and the same projects composed just fine.

Fixed by #10406 and released as v2.17.2.

Thanks for the report!