-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[BUG] Segmentation violation with empty Compose file #10986
Copy link
Copy link
Closed
compose-spec/compose-go
#457Closed
Copy link
Labels
Description
Description
What I saw:
I see a segmentation violation (SIGSEGV) when I run docker compose up with an empty Compose file in the present working directory.
What I expected:
Some kind of error about the Compose file being invalid. Maybe like...
$ docker compose up
configuration file invalid: emptySteps To Reproduce
- Ubuntu 22.04, bash
- Default
- Run
$ mkdir /tmp/empty_compose_file && cd /tmp/empty_compose_file && ls .
$ touch compose.yaml
$ docker compose up- See error...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x108bfb3]
goroutine 1 [running]:
github.com/compose-spec/compose-go/loader.load({0x2638c80, 0xc00035a320}, {{0x0, 0x0}, {0xc000145830, 0x8}, {0xc000578270, 0x1, 0x1}, 0xc000578000}, ...)
github.com/compose-spec/compose-go@v1.18.3/loader/loader.go:343 +0x893
github.com/compose-spec/compose-go/loader.LoadWithContext({0x2638c80, 0xc00035a320}, {{0x0, 0x0}, {0xc000145830, 0x8}, {0xc000578270, 0x1, 0x1}, 0xc000578000}, ...)
github.com/compose-spec/compose-go@v1.18.3/loader/loader.go:242 +0x2a5
github.com/compose-spec/compose-go/cli.ProjectFromOptions(0xc000224080)
github.com/compose-spec/compose-go@v1.18.3/cli/options.go:402 +0x4f2
github.com/docker/compose/v2/cmd/compose.(*ProjectOptions).ToProject(0xc0000c7680, {0x375d538, 0x0, 0x0}, {0xc000553890?, 0xc000553868?, 0x40fe27?})
github.com/docker/compose/v2/cmd/compose/compose.go:221 +0xfb
github.com/docker/compose/v2/cmd/compose.(*ProjectOptions).WithServices.func1({0x2638c80?, 0xc00035a320}, {0x375d538, 0x0, 0x0})
github.com/docker/compose/v2/cmd/compose/compose.go:156 +0x1fa
github.com/docker/compose/v2/cmd/compose.Adapt.func1({0x2638c80?, 0xc00035a320?}, 0x2?, {0x375d538?, 0x1?, 0xc000553950?})
github.com/docker/compose/v2/cmd/compose/compose.go:108 +0x36
github.com/docker/compose/v2/cmd/compose.AdaptCmd.func1(0xc000004900, {0x375d538, 0x0, 0x0})
github.com/docker/compose/v2/cmd/compose/compose.go:87 +0x21c
github.com/docker/compose/v2/cmd/cmdtrace.wrapRunE.func2(0xc000004900?, {0x375d538?, 0x0?, 0x0?})
github.com/docker/compose/v2/cmd/cmdtrace/cmd_span.go:80 +0x73
github.com/spf13/cobra.(*Command).execute(0xc000004900, {0xc000248370, 0x0, 0x0})
github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc00041ef00)
github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.7.0/command.go:992
github.com/docker/cli/cli-plugins/plugin.RunPlugin(0x188?, 0xc000004600, {{0x22d0b8e, 0x5}, {0x22daca9, 0xb}, {0x2611938, 0x7}, {0x0, 0x0}, ...})
github.com/docker/cli@v24.0.5+incompatible/cli-plugins/plugin/plugin.go:51 +0x130
github.com/docker/cli/cli-plugins/plugin.Run(0x240e410, {{0x22d0b8e, 0x5}, {0x22daca9, 0xb}, {0x2611938, 0x7}, {0x0, 0x0}, {0x0, ...}, ...})
github.com/docker/cli@v24.0.5+incompatible/cli-plugins/plugin/plugin.go:64 +0xee
main.pluginMain()
github.com/docker/compose/v2/cmd/main.go:37 +0xdf
main.main()
github.com/docker/compose/v2/cmd/main.go:75 +0x198
Compose Version
$ docker compose version
Docker Compose version v2.21.0
$ docker-compose version
Docker Compose version v2.17.2
Docker Environment
$ docker info
Client: Docker Engine - Community
Version: 24.0.6
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.21.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 13
Server Version: 24.0.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
runc version: v1.1.8-0-g82f18fe
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.15.0-83-generic
Operating System: Ubuntu 22.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.641GiB
Name: shadymeadow
ID: 40426b4d-c028-4f6b-97fd-9f1694be5808
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Anything else?
No response
Reactions are currently unavailable