Skip to content
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

Can't start on armv6 (Raspberry Pi Zero W) #9

Closed
mhansen opened this issue May 10, 2020 · 9 comments · Fixed by #10
Closed

Can't start on armv6 (Raspberry Pi Zero W) #9

mhansen opened this issue May 10, 2020 · 9 comments · Fixed by #10

Comments

@mhansen
Copy link
Contributor

mhansen commented May 10, 2020

Hey there, looks like 52d0771 removed support for arm32v6, replacing it with linux/arm,linux/arm64.

I've been using this container for a while on Raspberry Pi Zero W and it's started crashlooping with Restarting (139) 7 seconds ago, probably because of an unrecognized ARMv7 instruction.

I don't suppose this would be as simple to fix as adding linux/arm32v6 like this?

    - ARCHS="linux/arm,linux/arm64"
    - ARCHS="linux/arm,linux/arm64,linux/arm/v6"

Looks like linux/arm/v6 is the format according to https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux/

Btw, thanks for maintaining this, and no worries if you're not interested in supporting ARMv6, I can do a fork - I've gotten a lot of value already out of your image :-)

@carlosedp
Copy link
Owner

I'll take a look into that. It's kinda problem because Golang doesn't provide this image so I'll change the build to provide ARM32V6 as well.

Thanks for reporting

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

Thank you!

Go's pretty good at cross-compiling - I wonder if there's a simpler way than pulling an entire go ARMv6 builder... (caveat: I don't know much about docker buildx).

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

https://docs.docker.com/buildx/working-with-buildx/ notes that it's possible to use cross-compilation offered by some languages inside docker buildx

Finally, depending on your project, the language that you use may have good support for cross-compilation. In that case, multi-stage builds in Dockerfiles can be effectively used to build binaries for the platform specified with --platform using the native architecture of the build node. A list of build arguments like BUILDPLATFORM and TARGETPLATFORM is available automatically inside your Dockerfile and can be leveraged by the processes running as part of your build.

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

Their demo looks fairly straightforward for cross-compilation:

FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log
FROM alpine
COPY --from=build /log /log

Trouble would be converting docker's platform string linux/arm/v6 into what go GOARCH=arm and optionally GOARM=6. Maybe a wrapper script could convert the docker platform string to what go expects.

https://github.com/golang/go/wiki/GoArm

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

Here's an example wrapper script of someone doing the conversion from docker platform to GOARCH:

https://github.com/tonistiigi/xx/blob/master/golang/wrapper.sh#L26

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

Oh wow, it looks maybe as simple as adding two lines to your Dockerfile to add a wrapper script to alpine's go builder:

https://github.com/tonistiigi/xx/tree/master/golang

Or it'd be pretty easy to take the bits of logic you want and avoid the dep.

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

Here's an end-to-end example: chirpstack/chirpstack-docker#19 (comment)

@mhansen
Copy link
Contributor Author

mhansen commented May 11, 2020

I think I have this working:

https://hub.docker.com/repository/docker/markhnsn/arm_exporter/tags?page=1

Pull request soon

@carlosedp
Copy link
Owner

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants