Skip to content

golang:1.22.0-bullseye linux/amd64 reports dpkg architecture i386 #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomyl opened this issue Feb 7, 2024 · 6 comments
Closed

golang:1.22.0-bullseye linux/amd64 reports dpkg architecture i386 #509

tomyl opened this issue Feb 7, 2024 · 6 comments

Comments

@tomyl
Copy link

tomyl commented Feb 7, 2024

$ docker run -it --rm --platform linux/amd64 golang:1.22.0-bullseye dpkg --print-architecture
i386

Same for golang:1.22.0-bookworm. This is different from the previous version I was using:

$ docker run -it --rm --platform linux/amd64 golang:1.21.5-bullseye dpkg --print-architecture
amd64

I discovered this because I install docker in one of my Dockerfiles and their repo doesn't seem to provide i386 packages.

@xorkevin
Copy link

xorkevin commented Feb 7, 2024

Same issue here when running docker run --platform=linux/amd64 --rm -it --entrypoint /bin/sh golang:1.22.0-alpine3.19 and go env. I see:

...
GOARCH='386'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='386'
GOHOSTOS='linux'
...

Curiously enough, a docker inspect golang:1.22.0-alpine3.19 gives back

[
    {
        "Id": "sha256:6492fb3676d49badc7bc34c2485ade7e1afb195f12a878784ea62ad758e64252",
        "RepoTags": [
            "golang:1.22.0-alpine3.19"
        ],
        "RepoDigests": [
            "golang@sha256:298646364548cc5e1372e2612a6a2aaa53d44bed00284ecbc89b7aa8a83ad602"
        ],
...
        "Architecture": "386",
...

Seems like the bug could be on the docker side where only the x86 image is available and not x86_64?

A docker pull --platform=linux/amd64 golang:1.22.0-alpine3.19 as recommended by #481 (comment) gives me back the following:

1.22.0-alpine3.19: Pulling from library/golang
Digest: sha256:298646364548cc5e1372e2612a6a2aaa53d44bed00284ecbc89b7aa8a83ad602
Status: Image is up to date for golang:1.22.0-alpine3.19
docker.io/library/golang:1.22.0-alpine3.19

which does seem to match the repo digest that reports 386 as the architecture.

And as another datapoint, I see that when pulling alpine:3.19 directly, I get the following:

$ docker run --platform=linux/amd64 --rm -it --entrypoint /bin/sh alpine:3.19             
Unable to find image 'alpine:3.19' locally
3.19: Pulling from library/alpine
4abcf2066143: Already exists 
Digest: sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
Status: Downloaded newer image for alpine:3.19
/ # uname -m
x86_64
/ # apk --print-arch
x86_64

whereas apk --print-arch gives back x86 in golang:1.22.0-alpine3.19.

@gunturaf
Copy link

gunturaf commented Feb 7, 2024

@tomyl
Copy link
Author

tomyl commented Feb 7, 2024

@xorkevin Thanks for pointing me to the #481 (comment). I suppose this is simply a flawed/confusing docker behavior then, when the i386 image is available before amd64. Closing.

@tomyl tomyl closed this as completed Feb 7, 2024
@xorkevin
Copy link

xorkevin commented Feb 7, 2024

Thanks for reporting @tomyl , and thanks for confirming on the actual site @gunturaf . It hadn't occurred to me to look there. Seems like we're all looking for an x86_64 build that doesn't yet exist haha.

@stvoidit
Copy link

stvoidit commented Feb 7, 2024

#511 (comment)

I ran into the same problem, so I added an architecture refinement to my Dockerfile.
I think this may help to avoid a similar problem.

@tomyl
Copy link
Author

tomyl commented Feb 7, 2024

The amd64 image is available now 😃

docker run -it --rm amd64/golang:1.22.0-bookworm dpkg --print-architecture
amd64

@stvoidit Thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants