Skip to content

"docker buildx imagetools create" panic with "invalid memory address or nil pointer dereference" error #1425

@STARRY-S

Description

@STARRY-S

docker buildx version:

$ docker buildx version
github.com/docker/buildx v0.9.1-docker ed00243a0ce2a0aee75311b06e32d33b44729689

The panic happens when executing docker buildx imagetools create command:

$ docker buildx imagetools create --tag docker.io/hxstarrys/mirrored-nginx:latest '{"digest":"sha256:6ad8394ad31b269b563566998fd80a8f259e8decf16e807f8310ecc10c687385","mediaType":"application/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":1570}' '{"digest":"sha256:212dad360f60d13c80c7836df53ff98bb7f660bab5152baeba127a79a0df51f2","mediaType":"application/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":1570}' '{"digest":"sha256:1dab2771bc029bf840fd4d3eb137d0f205557aae8b5341b5f5ca16d50826c8e8","mediaType":"application/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":1570}' '{"digest":"sha256:d9aef1dc3d447aca00fbb5037879f02764a85a7f10afdb0484bb610d774663ac","mediaType":"application/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":1570}' '{"digest":"sha256:8a678aa6f62888245ff33a87de810f80702b40a5cab6c60b68c7c82e643fb777","mediaType":"application/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":1570}'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x105e827]

goroutine 28 [running]:
github.com/docker/buildx/util/imagetools.(*Resolver).Combine.func1.1()
	/src/util/imagetools/create.go:39 +0x87
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/src/vendor/golang.org/x/sync/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
	/src/vendor/golang.org/x/sync/errgroup/errgroup.go:72 +0xa5

The error still happens when using -f parameter to specify a json manifest file.

$ docker buildx imagetools create -f manifest.json --tag docker.io/hxstarrys/mirrored-nginx:latest
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1046e87]

goroutine 27 [running]:
github.com/docker/buildx/util/imagetools.(*Resolver).Combine.func1.1()
	/go/src/github.com/docker/buildx/util/imagetools/create.go:35 +0x87
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/go/src/github.com/docker/buildx/vendor/golang.org/x/sync/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/src/github.com/docker/buildx/vendor/golang.org/x/sync/errgroup/errgroup.go:72 +0xa5

The manifest.json file is:

{
  "digest": "sha256:6ad8394ad31b269b563566998fd80a8f259e8decf16e807f8310ecc10c687385",
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "platform": {
    "architecture": "amd64",
    "os": "linux"
  },
  "size": 1570
}

The error does not happen when downgrade docker-buildx to 0.4.2.

$ cd ~/.docker/cli-plugins
$ wget https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64 -O docker-buildx && chmod +x ./docker-buildx
$ docker buildx version
github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2
$ docker buildx imagetools create -f manifest.json --tag docker.io/hxstarrys/mirrored-nginx:latest
docker.io/hxstarrys/mirrored-nginx:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions