docker-library / golang

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

golang:1.21.5 on linux/arm/v6 : no match for platform in manifest #502

Closed buchdag closed 6 months ago

buchdag commented 6 months ago

Hi

linux/arm/v6 version of golang:1.21.5 seems to have disappeared (this was working yesterday):

#7 [linux/arm/v6 internal] load metadata for docker.io/library/golang:1.21.5
#7 ERROR: no match for platform in manifest: not found

https://github.com/nginx-proxy/docker-gen/actions/runs/7281452341/job/19844016060#step:9:182

tianon commented 6 months ago

See https://github.com/docker-library/golang/pull/500 -- this was an intentional change. Suggested workarounds are downgarding to Go 1.20 or switching to the Alpine-based images (which as an added benefit will be properly arm32v6 instead of the arm32v5 you were getting previously, and thus likely quite a bit more performant).

tianon commented 6 months ago

(if you're not running natively on the target architecture, you might also consider cross compiling instead of emulating the CPU architecture -- Go's really good at it :smile:)

tianon commented 6 months ago

See https://github.com/tianon/dockerfiles/blob/6dff6b254b7718a4430052f26eb03c7f5326ebb3/buildkit/Dockerfile for a fairly straightforward example of how to make the cross-compile work using buildkit's built-in support for doing so (--platform=$BUILDPLATFORM vs $TARGETxxx variables).

buchdag commented 6 months ago

Don't get this wrong but I'm really confused about how a given tag of an official Docker library image can be available for a given arch one day, then not available anymore the next day, no matter how intentional and technically sound the change.

Did the arm/v6 versions of 1.21.x have an issue that justified removing them entirely from Dockerhub post initial release ?

tianon commented 6 months ago

The only actual arm/v6 images we've ever had for any version are the Alpine variants -- the Debian-based variants have always been arm/v5 (which will run on an arm/v6 system, which is why --platform linux/arm/v6 pulled those). If you still need them, they're still available via arm32v5/golang:xxx.

buchdag commented 6 months ago

That's noted.

Thanks for the ressources on cross-compiling.

buchdag commented 6 months ago

See https://github.com/tianon/dockerfiles/blob/6dff6b254b7718a4430052f26eb03c7f5326ebb3/buildkit/Dockerfile for a fairly straightforward example of how to make the cross-compile work using buildkit's built-in support for doing so (--platform=$BUILDPLATFORM vs $TARGETxxx variables).

Thanks for the example @tianon, I implemented it pretty much the same way and it works damn well. Makes you wish other languages had cross compilation capabilities on par with Go ...