Support docker-compose/compose.yaml inspection in azd init app detection
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Problem
`azd init` currently detects apps by looking for language-specific project files and inspecting individual Dockerfiles for `EXPOSE` directives (`internal/appdetect/docker.go`). It has **no awareness of docker-compose.yml / compose.yaml files**, which are the primary way many teams define multi-service app topology.
This means `azd init` misses rich information that compose files provide: service definitions, port mappings, build contexts, inter-service dependencies, volumes, networks, and environment variables.
## Proposed Solution
Add docker-compose/compose.yaml inspection to `azd init` app detection:
### Phase 1: Parse and Extract
- Detect `docker-compose.yml`, `compose.yaml`, `compose.yml`, `docker-compose.yaml` (and override files)
- Parse service definitions: name, build context, image, ports, depends_on, volumes, environment, networks
- Handle multi-file compose setups (`compose.override.yml`, `-f` patterns)
### Phase 2: Enrich App Detection
- Use compose port mappings (`ports:`) as primary port source (more reliable than Dockerfile `EXPOSE`)
- Map compose `depends_on` to azure.yaml service dependencies
- Use compose service names as azure.yaml service name suggestions
- Detect databases, caches, message queues from well-known images (postgres, redis, rabbitmq, etc.)
### Phase 3: Scaffold Generation
- Generate richer `azure.yaml` from compose topology
- Map compose services to appropriate Azure resources (Container Apps, databases, caches)
- Preserve compose-defined environment variable patterns
## Current Behavior
`azd init` only inspects:
- Language project files (go.mod, package.json, requirements.txt, etc.)
- Individual Dockerfiles for `EXPOSE` directives
## Related
- Supersedes #4600 (select docker compose file)
- Improves `internal/appdetect/` detection pipeline
Contributor guide
Assessment
This issue has not been assessed yet.