Last active
February 29, 2024 16:14
-
-
Save barsa-net/e049b9651677491bda8ca1ca4ce2ab7c to your computer and use it in GitHub Desktop.
wagoodman/dive image builder for ARM64/aarch64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:alpine AS builder | |
RUN apk update && \ | |
apk add git make | |
WORKDIR /go/src | |
ARG DIVE_VERSION=${DIVE_VERSION:-v0.10.0} | |
RUN git clone https://github.com/wagoodman/dive.git dive && \ | |
git -C /go/src/dive checkout ${DIVE_VERSION} | |
WORKDIR /go/src/dive | |
ENV CGO_ENABLED=0 | |
RUN make build | |
FROM scratch AS export-stage | |
COPY --from=builder /go/src/dive/dist/dive_linux_amd64/dive . | |
FROM alpine:3.12 | |
ARG DOCKER_CLI_VERSION=${DOCKER_CLI_VERSION:-19.03.1} | |
RUN wget -O- https://download.docker.com/linux/static/stable/$(uname -m)/docker-${DOCKER_CLI_VERSION}.tgz | \ | |
tar -xzf - docker/docker --strip-component=1 && \ | |
mv docker /usr/local/bin | |
COPY --from=builder /go/src/dive/dist/dive_linux_amd64/dive /usr/local/bin | |
ENTRYPOINT ["/usr/local/bin/dive"] |
Thanks, it almost worked for Raspberry Pi 4 (armv71).
I had to make two changes:
- In the Dockerfile I changed
$(uname -m)
toarmhf
:
RUN wget -O- https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_CLI_VERSION}.tgz | \
- I added the Docker version (obtained with
docker -v
) when building the image:
docker build . -t wagoodman/dive:latest --build-arg DOCKER_CLI_VERSION=20.10.12
This is great, thank you. It seems to work for aarch64 as well. Working with Nvidia Jetson docker files here.
I was hoping to use dive to inspect a very large (30GB) dev docker image since I don't have enough free space on the VM to do a docker save
on it. Unfortunately it looks like dive also has to make a copy and i also ran out of disk trying to run dive... Oh well, time to expand the vm disk one more time.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As wagoodman/dive does not come with an aarch64 image, I use this Dockerfile as one-file image builder on my RPi.
It has not thoroughly tested but it should work in most cases.
Usage
Docker Image
Build as usual, tagging it as the original image
then you can just use it with the official suggested run options:
Binary
If your prefer to have a binary to install on your local system you use BuildKit and you will find the binary inside dist/ folder, building should consume about ~600MiB of disk space and it takes about ~130s on my RPi 4
NOTE: to build this you must have Docker 18.09 or higher
Cleanup
FYI, you can prune the builder cache doing