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

Docker image for ARM #14617

Merged
merged 1 commit into from Jan 9, 2019

Conversation

Projects
None yet
4 participants
@johanneswuerbach
Copy link
Contributor

commented Dec 20, 2018

Build and push docker images for armv7 and arm64.

Fixes #13186

Building
The ARM images are building using binfmt_misc, which is the same mechanism also used by Docker for Mac to support building ARM images, some details are here https://www.ecliptik.com/Cross-Building-and-Running-Multi-Arch-Docker-Images/

While the circle docker executor doesn't natively support building ARM images, the machine executor has almost all the necessary dependencies pre-installed and allows privileged execution, which is required to setup binfmt_misc

The setup itself is done viadocker run --privileged linuxkit/binfmt:v0.6, which is the same script also used inside Docker for Mac. (Source https://github.com/linuxkit/linuxkit/tree/master/pkg/binfmt)

As the default machine image is fairly old and binfmt_misc requires a Kernel 4.8+, use a more recent machine image https://circleci.com/docs/2.0/configuration-reference/#machine

Publishing
The two ARM images would be published to grafana/grafana-arm32v7-linux:TAG and grafana/grafana-arm64v8-linux:TAG (release images) and grafana/grafana-dev-arm32v7-linux:TAG and grafana/grafana-dev-arm64v8-linux:TAG (dev images), so those 4 docker hub repositories would need to be created.

To simplify image consumption a multi-arch manifest is created using https://docs.docker.com/edge/engine/reference/commandline/manifest/, which allows docker pull grafana/grafana to pull the respective amd64, arm32 and arm64 image automatically.

Test

Build images locally and pushed them to my registry using:

./build.sh multi-test johanneswuerbach/grafana-dev
./push_to_docker_hub.sh multi-test johanneswuerbach/grafana-dev

Using them on macOS via Docker for Mac:

docker pull johanneswuerbach/grafana-dev:multi-test && docker run --rm -it johanneswuerbach/grafana-dev:multi-test -v
multi-test: Pulling from johanneswuerbach/grafana-dev
Digest: sha256:9073e733b641910d0e016df4e239e2161835f72e407663a49d16597cfe5afdde
Status: Image is up to date for johanneswuerbach/grafana-dev:multi-test
Version 5.5.0-pre1 (commit: 0f535a8, branch: arm-image)

Using them on a Raspberry Pi 3:

$ docker pull johanneswuerbach/grafana-dev:multi-test && docker run --rm -it johanneswuerbach/grafana-dev:multi-test -v
multi-test: Pulling from johanneswuerbach/grafana-dev
Digest: sha256:9073e733b641910d0e016df4e239e2161835f72e407663a49d16597cfe5afdde
Status: Image is up to date for johanneswuerbach/grafana-dev:multi-test
Version 5.5.0-pre1 (commit: 0f535a8, branch: arm-image)

while the current latest fails as expected:

$ docker pull grafana/grafana && docker run --rm -it grafana/grafana
Using default tag: latest
latest: Pulling from grafana/grafana
Digest: sha256:b9a31857e86e9cf43552605bd7f3c990c123f8792ab6bea8f499db1a1bdb7d53
Status: Downloaded newer image for grafana/grafana:latest
standard_init_linux.go:190: exec user process caused "exec format error"

Feedback more then welcome :-)

@CLAassistant

This comment has been minimized.

Copy link

commented Dec 20, 2018

CLA assistant check
All committers have signed the CLA.

@johanneswuerbach johanneswuerbach force-pushed the johanneswuerbach:arm-image branch 4 times, most recently from 0f535a8 to b3c3475 Dec 20, 2018

@johanneswuerbach johanneswuerbach force-pushed the johanneswuerbach:arm-image branch from b3c3475 to 08303b2 Dec 21, 2018

@xlson
Copy link
Contributor

left a comment

Wow, a lot of users are waiting for this. I'm on vacation right now but I look forward to testing your pr in early January.

@xlson xlson self-assigned this Jan 7, 2019

@xlson

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2019

@johanneswuerbach PR looks great. I'm going to go ahead and merge it. Thanks for creating this!

@xlson xlson merged commit 5f7e6a5 into grafana:master Jan 9, 2019

2 checks passed

build-branches-and-prs Workflow: build-branches-and-prs
Details
license/cla Contributor License Agreement is signed.
Details
@johanneswuerbach

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2019

@xlson seems there are some CI failures on master related to this, do you need help with them? It was kind of hard for me to validate those steps without being able to run CI.

@johanneswuerbach johanneswuerbach deleted the johanneswuerbach:arm-image branch Jan 9, 2019

@xlson

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2019

@johanneswuerbach No worries. I've been trying to correct them but I'm out of time today so I reverted the changes for now and will go back to it tomorrow. So many moving parts with CI unfortunately.

Thanks for offering to help, but I should be fine. The CI for Grafana is my mess after all ;)

@xlson xlson added this to the 6.0 milestone Jan 10, 2019

@xlson

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2019

Worked through the ci scripts today on my local machine and was able to fix the issues and merge this PR this afternoon. Thanks again!

@johanneswuerbach

This comment has been minimized.

Copy link
Contributor Author

commented Jan 10, 2019

Thank you 🙏 and sorry for the trouble

@xlson

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2019

@johanneswuerbach My pleasure :)

vielmetti added a commit to WorksOnArm/worksonarm-news that referenced this pull request Jan 18, 2019

updates #121
* grafana/grafana#14617
* https://hub.docker.com/r/grafana/grafana

Signed-off-by: Edward Vielmetti <ed@packet.net>

@marefr marefr modified the milestones: 6.0, 6.0-beta1 Jan 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.