diff --git a/cmd/compose/compose.go b/cmd/compose/compose.go index c15241415..cfa5154a1 100644 --- a/cmd/compose/compose.go +++ b/cmd/compose/compose.go @@ -142,6 +142,10 @@ func (o *projectOptions) projectOrName() (*types.Project, string, error) { if o.ProjectName == "" { p, err := o.toProject(nil) if err != nil { + envProjectName := os.Getenv("COMPOSE_PROJECT_NAME") + if envProjectName != "" { + return nil, envProjectName, nil + } return nil, "", err } project = p diff --git a/pkg/e2e/fixtures/start-stop/other.yaml b/pkg/e2e/fixtures/start-stop/other.yaml index c28cbd09b..587827261 100644 --- a/pkg/e2e/fixtures/start-stop/other.yaml +++ b/pkg/e2e/fixtures/start-stop/other.yaml @@ -2,4 +2,4 @@ services: a-different-one: image: nginx:alpine and-another-one: - image: nginx:alpine \ No newline at end of file + image: nginx:alpine