docker-library / golang

Docker Official Image packaging for golang
https://golang.org
BSD 3-Clause "New" or "Revised" License
1.48k stars 510 forks source link

libc.so.6: version `GLIBC_2.3x' not found (from binaries built in new bookworm based images but run on older distros) #466

Closed zhiweiyin318 closed 1 year ago

zhiweiyin318 commented 1 year ago

I used golang:1.20 which built yesterday to build my image, my image failed to run with the errors

/placement: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by /placement)
/placement: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /placement)

the golang:1.20 digest: golang@sha256:3164c26b2e170b18e2325aa0554699e7bb19a658333601659c04838855897f7a

when I changed to 1.20.4, everything is ok.

tianon commented 1 year ago

This is unfortunately not unexpected. See also https://github.com/docker-library/official-images/pull/14857#issuecomment-1591968024:

They can also specify the Debian version of the Golang images (only the two most recent are updated/supported): golang:1.20.5-bullseye or golang:1.20.5-bookworm (and golang:1.20-bullseye, etc).

If you don't need cgo in your binary, it should also work to specify CGO_ENABLED=0 explicitly.

zhiweiyin318 commented 1 year ago

thanks @tianon