romkatv / zsh4humans

A turnkey configuration for Zsh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`docker compose` panic due to `docker()` function?

pn-santos opened this issue · comments

Using any docker compose file, when I run docker compose config I'm getting a panic:

❯ docker compose config
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/compose-spec/compose-go/utils.GetAsEqualsMap({0xc000136a00, 0x66, 0x30?})
        github.com/compose-spec/compose-go@v1.13.5/utils/stringutils.go:46 +0x105
github.com/compose-spec/compose-go/cli.WithOsEnv(0xc0005b01c0)
        github.com/compose-spec/compose-go@v1.13.5/cli/options.go:220 +0x38
github.com/compose-spec/compose-go/cli.NewProjectOptions({0x3241268, 0x0, 0x0}, {0xc0003c2d40, 0x8, 0x22?})
        github.com/compose-spec/compose-go@v1.13.5/cli/options.go:91 +0xdb
github.com/docker/compose/v2/cmd/compose.(*ProjectOptions).toProjectOptions(0xc0001b1400, {0x0, 0x0, 0x0})
        github.com/docker/compose/v2/cmd/compose/compose.go:236 +0x2e9
github.com/docker/compose/v2/cmd/compose.setEnvWithDotEnv(0x0?)
        github.com/docker/compose/v2/cmd/compose/compose.go:441 +0x35
github.com/docker/compose/v2/cmd/compose.RootCommand.func2(0xc0005c8f00, {0x3241268, 0x0, 0x0})
        github.com/docker/compose/v2/cmd/compose/compose.go:297 +0xbd
main.pluginMain.func1.1(0xc0005c8f00?, {0x3241268, 0x0, 0x0})
        github.com/docker/compose/v2/cmd/main.go:45 +0x6b
github.com/spf13/cobra.(*Command).execute(0xc0005c8f00, {0xc0001b5670, 0x0, 0x0})
        github.com/spf13/cobra@v1.7.0/command.go:915 +0x739
github.com/spf13/cobra.(*Command).ExecuteC(0xc00002ef00)
        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, {{0x1fb4efd, 0x5}, {0x1fbe7b8, 0xb}, {0x22ad890, 0x7}, {0x0, 0x0}, ...})
        github.com/docker/cli@v23.0.6+incompatible/cli-plugins/plugin/plugin.go:51 +0x130
github.com/docker/cli/cli-plugins/plugin.Run(0x20d6bc0, {{0x1fb4efd, 0x5}, {0x1fbe7b8, 0xb}, {0x22ad890, 0x7}, {0x0, 0x0}, {0x0, ...}, ...})
        github.com/docker/cli@v23.0.6+incompatible/cli-plugins/plugin/plugin.go:64 +0xee
main.pluginMain()
        github.com/docker/compose/v2/cmd/main.go:36 +0xdf
main.main()
        github.com/docker/compose/v2/cmd/main.go:68 +0x198

AFAICT docker is being aliased by zsh4humans with:

❯ which docker
docker () {
        z4h docker "$@"
}

If I bypass it by running /usr/bin/docker compose config the panic no longer happens. So I think it might be related to that docker() function is doing (could also be mishandling of the input by the docker compose plugin?)

I though I'd report this in case it is related to the alias function.

Potentially Relevant Context

❯ zsh --version
zsh 5.8 (x86_64-pc-linux-musl)

❯ docker --version
Docker version 24.0.1, build 680212

❯ docker info
Client: Docker Engine - Community
 Version:    24.0.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Using latest v5 branch install with no extra plugins.

Humm nvm the issue was related to env vars so might not be z4h after all - nothing to see here.

What is the output of the following command?

( set -x; typeset -p TERM; docker compose config )

Does this work?

command docker compose config

How about this?

TERM=screen-256color command docker compose config

Humm nvm the issue was related to env vars so might not be z4h after all - nothing to see here.

I just noticed this comment. Please ignore my questions.