Skip to content

Instantly share code, notes, and snippets.

@barsa-net
Last active February 29, 2024 16:14
Show Gist options
  • Save barsa-net/e049b9651677491bda8ca1ca4ce2ab7c to your computer and use it in GitHub Desktop.
Save barsa-net/e049b9651677491bda8ca1ca4ce2ab7c to your computer and use it in GitHub Desktop.
wagoodman/dive image builder for ARM64/aarch64
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"]
@lukaszmn
Copy link

Thanks, it almost worked for Raspberry Pi 4 (armv71).

I had to make two changes:

  1. In the Dockerfile I changed $(uname -m) to armhf:
RUN wget -O- https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_CLI_VERSION}.tgz | \
  1. 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

@unphased
Copy link

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