Compose V1, the standalone Python docker-compose binary, named containers project_service_1. Compose V2, the Go plugin invoked as docker compose, names them project-service-1 with hyphens. V1 reached end of life in July 2023 and was removed from Docker Desktop.
Anything that referenced containers by generated name breaks: docker exec myproj_web_1 ... in a shell script, log-scraping tools matching the underscore pattern, and monitoring rules keyed on container name.
The robust fix is to stop using generated names. Use docker compose exec web ..., which resolves the service name itself, or set an explicit container_name on services that external tooling must address. If a legacy name must be preserved during a migration, docker compose --compatibility restores the underscore separator, but that flag also re-enables other V1 behaviors and is not a long-term answer. The project name defaults to the directory name and can be pinned with the top-level name key or COMPOSE_PROJECT_NAME.