Skip to content

Commit cd043fb

Browse files
committed
fix: prevent nil map panic when docker-compose.yaml has top-level name field
When a docker-compose.yaml includes a top-level 'name:' field, the compose-go loader attempts to assign to ConfigDetails.Environment which is nil, causing a panic. Initialize the Environment map to an empty map before calling the loader. Fixes #2970
1 parent a91772b commit cd043fb

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

pkg/devspace/compose/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func LoadDockerComposeProject(path string) (*composetypes.Project, error) {
4444
Content: composeFile,
4545
},
4646
},
47+
Environment: map[string]string{},
4748
})
4849
if err != nil {
4950
return nil, err
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v2beta1
2+
name: docker-compose
3+
deployments:
4+
web:
5+
helm:
6+
values:
7+
containers:
8+
- name: web-container
9+
image: nginx:latest
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: myproject
2+
services:
3+
web:
4+
image: nginx:latest

0 commit comments

Comments
 (0)