Skip to content

[BUG] Proxy settings defined in config and no build args in compose file cause build commands to fail #10244

Closed
@komima

Description

@komima

Description

When a compose file defines an image to be built, no other build args are provided, build process requires the proxy variables and proxies are set in config.json, build fails:

panic: assignment to entry in nil map

goroutine 25 [running]:
github.com/docker/compose/v2/pkg/compose.(*composeService).toBuildOptions(_, _, {{0xc0004e0d50, 0x9}, {0x0, 0x0, 0x0}, 0xc000234d80, 0x0, {0x0, ...}, ...}, ...)
        github.com/docker/compose/v2/pkg/compose/build.go:236 +0x31c
github.com/docker/compose/v2/pkg/compose.(*composeService).build.func1({0x2174f20, 0xc0005fa140}, {0xc0004e0d50?, 0x9?})
        github.com/docker/compose/v2/pkg/compose/build.go:68 +0x2b0
github.com/docker/compose/v2/pkg/compose.(*graphTraversal).run.func1()
        github.com/docker/compose/v2/pkg/compose/dependencies.go:127 +0x63
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
        golang.org/x/sync@v0.1.0/errgroup/errgroup.go:72 +0xa5

Found this issue when I was testing docker-compose with podman machine, and I needed the results of #10159 to get the proxy vars into the build automatically. I'm not so familiar with Go, but it seems that the assignment fails due to flatten result being nil, when there are no build args from the compose file?

Steps To Reproduce

  1. Be behind corporate proxy
  2. Add proxies to ~/.docker/config.json
  3. Use a compose file with an image build and no build args
  4. docker compose build fails with panic: assignment to entry in nil map
  5. Add any build arg to the compose file
  6. docker compose build succeeds

Compose Version

Docker Compose version b3ec110 (downloaded from latest v2 commit action artifact)

Docker Environment

not docker, but podman machine on Windows 10 WSL2 with DOCKER_BUILDKIT=0 and DOCKER_HOST pointing to the podman api

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions