fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Push multi-platform image to Dockerhub with amd64, arm64

Open zhumo opened this issue 3 years ago • 6 comments

Problem

There are more and more arm64 servers, which are better for cost and performance. Our users would like to take advantage of that by deploying fleet on arm64 servers. We should provide an easy solution on Dockerhub, which is where our users primarily get Fleet.

Business Case

  • Reduce cost for our community and customers
  • Maintain Fleet at forefront of technology

Measurement

N/A

Requirements

  1. Dockerhub option available for deploying Fleet to Linux ARM64. Consider the suggestion here: https://github.com/fleetdm/fleet/issues/1845#issuecomment-1312379729
  • Documentation There is a pre-existing segment of the
  • Other depts. See if marketing wants to talk about this?

Design

UI

TODO

API

TODO

CLI

TODO

Related

Child issues

Interface team

  • TODO

Platform team

  • TODO

Agent team

  • TODO

Documentation

  • TODO

zhumo avatar Dec 01 '22 18:12 zhumo

Here are some notes I wrote while testing on MacOS

Useful resources:

  • https://docs.docker.com/registry/deploying/
  • https://docs.docker.com/build/building/multi-platform/
  • docker does not support local multi-platform images https://github.com/docker/buildx/issues/166#issuecomment-544827163

Run a local docker registry https://docs.docker.com/registry/deploying/. Note that on MacOS port 5000 is already used. Must map to a different port

docker run -d -p 5001:5000 --restart=always --name registry registry:2

Whenever you build, include the registry ie localhost:5001 in front of the tag eg --tag localhost:5001/fleetdm/fleet

Enable docker experimental (MacOS). Go to Docker Desktop Preferences -> Docker Engine and edit daemon.json with the following

"experimental": true,

Create a docker builder instance, with some extra configuration to use the local registry

Create buildkit.toml containing

[registry."host.docker.internal:5001"]
  http = true
docker buildx create --use --config buildkit.toml

Here is a partial wip Dockerfile that uses builds fleet inside the image, instead of copying it from the docker build context.

FROM --platform=$BUILDPLATFORM golang:1.19.3-alpine3.16 as builder

ARG TARGETOS
ARG TARGETARCH

WORKDIR /src
COPY . .

RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build ...

Finally, build a multi platform image and push to local registry using

docker buildx build --platform linux/amd64,linux/arm64 -t docker.host.internal:5001/fleetdm/fleet:<version> --push -f Dockerfile .

And inspect it using

docker buildx imagetools inspect fleetdm/fleet:<version>

michalnicp avatar Dec 06 '22 18:12 michalnicp

Hey @ksatter, heads up, we didn't have the space to take this on in the current design sprint (4.48).

Please feel free to bring it to the upcoming feature fest!

noahtalerman avatar Mar 12 '24 14:03 noahtalerman

Any updates on this?

devantler avatar Sep 28 '24 20:09 devantler

See also: https://github.com/fleetdm/fleet/issues/2466

bardiharborow avatar Dec 07 '24 07:12 bardiharborow

Hi folks, any update on this?

alirezaghey avatar Jan 27 '25 13:01 alirezaghey

Still no arm64 images at https://hub.docker.com/r/fleetdm/fleet

Any idea how these images are built? There's a thousand Dockerfiles and zero docs.

shapirus avatar Apr 06 '25 22:04 shapirus

Add my updoot for this! Our clusters are predominantly ARM based!

justinb-dfw avatar Jul 09 '25 19:07 justinb-dfw