Skip to content

"imagetools create" panics when pushing the created image #2229

@dunglas

Description

@dunglas

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Running docker buildx imagetools create sometimes panic when pushing the newly created image to the repository.

Expected behaviour

The image should be pushed.

Actual behaviour

fatal error: concurrent map writes
fatal error: concurrent map writes

Buildx version

github.com/docker/buildx v0.12.1 30feaa1

Docker info

/usr/bin/docker version
  Client: Docker Engine - Community
   Version:           24.0.7
   API version:       1.43
   Go version:        go1.20.10
   Git commit:        afdd53b
   Built:             Thu Oct 26 09:07:41 2023
   OS/Arch:           linux/amd64
   Context:           default
  
  Server: Docker Engine - Community
   Engine:
    Version:          24.0.7
    API version:      1.43 (minimum version 1.12)
    Go version:       go1.20.10
    Git commit:       311b9ff
    Built:            Thu Oct 26 09:07:41 2023
    OS/Arch:          linux/amd64
    Experimental:     false
   containerd:
    Version:          1.6.27
    GitCommit:        a1496014c916f9e62104b33d1bb5bd03b0858e59
   runc:
    Version:          1.1.11
    GitCommit:        v1.1.11-0-g4bccb38
   docker-init:
    Version:          0.19.0
    GitCommit:        de40ad0
  /usr/bin/docker info
  Client: Docker Engine - Community
   Version:    24.0.7
   Context:    default
   Debug Mode: false
   Plugins:
    buildx: Docker Buildx (Docker Inc.)
      Version:  v0.12.1
      Path:     /usr/libexec/docker/cli-plugins/docker-buildx
    compose: Docker Compose (Docker Inc.)
      Version:  v2.23.3
      Path:     /usr/libexec/docker/cli-plugins/docker-compose
  
  Server:
   Containers: 0
    Running: 0
    Paused: 0
    Stopped: 0
   Images: 14
   Server Version: 24.0.7
   Storage Driver: overlay2
    Backing Filesystem: extfs
    Supports d_type: true
    Using metacopy: false
    Native Overlay Diff: false
    userxattr: false
   Logging Driver: json-file
   Cgroup Driver: cgroupfs
   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: a1496014c916f9e62104b33d1bb5bd03b0858e59
   runc version: v1.1.11-0-g4bccb38
   init version: de40ad0
   Security Options:
    apparmor
    seccomp
     Profile: builtin
    cgroupns
   Kernel Version: 6.2.0-1019-azure
   Operating System: Ubuntu 22.04.3 LTS
   OSType: linux
   Architecture: x86_64
   CPUs: 4
   Total Memory: 15.61GiB
   Name: fv-az849-367
   ID: 8abab386-ee6f-4a46-817c-c1639873e713
   Docker Root Dir: /var/lib/docker
   Debug Mode: false
   Username: githubactions
   Experimental: false
   Insecure Registries:
    127.0.0.0/8
   Live Restore Enabled: false

Builders list

Created using the `docker/setup-buildx-action` GitHub actions.

Configuration

Bake definition: https://github.com/dunglas/frankenphp/blob/main/docker-bake.hcl (Dockerfiles in the same repo).

Build logs

#1 [internal] pushing docker.io/***/frankenphp-dev:5a8e5f95184fc623ce3316d584a71911ca086712-builder-php8.2
fatal error: concurrent map writes
fatal error: concurrent map writes

goroutine 149 [running]:
github.com/docker/buildx/util/imagetools.(*Resolver).Copy(0xc000650b70, {0x25c1778?, 0xc00016a230?}, 0xc0001a14d0, {0x25aa4b8, 0xc00041b1a0})
	github.com/docker/buildx/util/imagetools/create.go:237 +0x43f
github.com/docker/buildx/commands/imagetools.runCreate.func2.1.1()
	github.com/docker/buildx/commands/imagetools/create.go:194 +0x1c6
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 119
	golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc000452150?)
	runtime/sema.go:62 +0x25
sync.(*WaitGroup).Wait(0x211a5e0?)
	sync/waitgroup.go:116 +0x48
golang.org/x/sync/errgroup.(*Group).Wait(0xc0005a35c0)
	golang.org/x/sync@v0.3.0/errgroup/errgroup.go:53 +0x25
github.com/docker/buildx/commands/imagetools.runCreate({0x25d4680, 0xc0000320f0}, {{0x0, 0x0}, {0x371e740, 0x0, 0x0}, {0xc000392600, 0xc, 0x10}, ...}, ...)
	github.com/docker/buildx/commands/imagetools/create.go:207 +0x11f2
github.com/docker/buildx/commands/imagetools.createCmd.func1(0xc000145800?, {0xc0001af340?, 0x4?, 0x223c232?})
	github.com/docker/buildx/commands/imagetools/create.go:277 +0x85
github.com/spf13/cobra.(*Command).execute(0xc000388600, {0xc000051030, 0x1c, 0x1c})
	github.com/spf13/cobra@v1.7.0/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000388c00)
	github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.7.0/command.go:992
github.com/docker/cli/cli-plugins/plugin.RunPlugin(0x1ec5000?, 0xc000005500, {{0x223cdc6, 0x5}, {0x2246bf0, 0xb}, {0x2599f70, 0x7}, {0x0, 0x0}, ...})
	github.com/docker/cli@v24.0.5+incompatible/cli-plugins/plugin/plugin.go:51 +0x12a
main.runPlugin(0x228336e?)
	github.com/docker/buildx/cmd/buildx/main.go:47 +0x105
main.main()
	github.com/docker/buildx/cmd/buildx/main.go:64 +0xe5

goroutine 33 [syscall]:
os/signal.signal_recv()

goroutine 201 [select]:
net.(*Resolver).lookupIPAddr(0x36e4580, {0x25c1740?, 0xc00089e1e0}, {0x223bc6c, 0x3}, {0xc0006fe108, 0x14})
	net/lookup.go:332 +0x3fe
net.(*Resolver).internetAddrList(0x25c1740?, {0x25c1740?, 0xc00089e1e0?}, {0x223bc6c, 0x3}, {0xc0006fe108?, 0xc00089e1e0?})
	net/ipsock.go:288 +0x4e5
net.(*Resolver).resolveAddrList(0x1ef1f60?, {0x25c1740, 0xc00089e1e0}, {0x223c4ca, 0x4}, {0x223bc6c?, 0x444e452d2d2d2d2d?}, {0xc0006fe108, 0x18}, {0x0, ...})
	net/dial.go:282 +0x405
net.(*Dialer).DialContext(0xc000167810, {0x25c1740, 0xc00089e150}, {0x223bc6c, 0x3}, {0xc0006fe108, 0x18})
	net/dial.go:488 +0x42c
net/http.(*Transport).dial(0xc000058795?, {0x25c1740?, 0xc00089e150?}, {0x223bc6c?, 0x0?}, {0xc0006fe108?, 0xc0007b6810?})
	net/http/transport.go:1183 +0xd2
net/http.(*Transport).dialConn(0x36ca260, {0x25c1740, 0xc00089e150}, {{}, 0x0, {0xc00055f290, 0x5}, {0xc0006fe108, 0x18}, 0x0})
	net/http/transport.go:1625 +0x7e8
net/http.(*Transport).dialConnFor(0x0?, 0xc000546f20)
	net/http/transport.go:1467 +0x9f
created by net/http.(*Transport).queueForDial in goroutine 200
	net/http/transport.go:1436 +0x3cb

goroutine 134 [select]:
net.(*Resolver).lookupIPAddr(0x36e4580, {0x25c1740?, 0xc0006515c0}, {0x223bc6c, 0x3}, {0xc0005b7080, 0x14})
	net/lookup.go:332 +0x3fe
net.(*Resolver).internetAddrList(0x25c1740?, {0x25c1740?, 0xc0006515c0?}, {0x223bc6c, 0x3}, {0xc0005b7080?, 0xc0006515c0?})
	net/ipsock.go:288 +0x4e5
net.(*Resolver).resolveAddrList(0x1ef1f60?, {0x25c1740, 0xc0006515c0}, {0x223c4ca, 0x4}, {0x223bc6c?, 0x2258b30?}, {0xc0005b7080, 0x18}, {0x0, ...})
	net/dial.go:282 +0x405
net.(*Dialer).DialContext(0xc000167810, {0x25c1740, 0xc000651530}, {0x223bc6c, 0x3}, {0xc0005b7080, 0x18})
	net/dial.go:488 +0x42c
net/http.(*Transport).dial(0xc000542175?, {0x25c1740?, 0xc000651530?}, {0x223bc6c?, 0x0?}, {0xc0005b7080?, 0xc00079f680?})
	net/http/transport.go:1183 +0xd2
net/http.(*Transport).dialConn(0x36ca260, {0x25c1740, 0xc000651530}, {{}, 0x0, {0xc000448ab0, 0x5}, {0xc0005b7080, 0x18}, 0x0})
	net/http/transport.go:1625 +0x7e8
net/http.(*Transport).dialConnFor(0x0?, 0xc0006102c0)
	net/http/transport.go:1467 +0x9f
created by net/http.(*Transport).queueForDial in goroutine 133
	net/http/transport.go:1436 +0x3cb

goroutine 110 [running]:
github.com/docker/buildx/util/imagetools.(*Resolver).Copy(0xc000650b70, {0x25c1778?, 0xc00016a230?}, 0xc0001a14d0, {0x25aa4b8, 0xc00041b8a0})
	github.com/docker/buildx/util/imagetools/create.go:237 +0x43f
github.com/docker/buildx/commands/imagetools.runCreate.func2.1.1()
	github.com/docker/buildx/commands/imagetools/create.go:194 +0x1c6
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 125
	golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96

Additional info

The crash occurs in GitHub actions: https://github.com/dunglas/frankenphp/actions/runs/7725421734/job/21060087611

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