Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
Last active June 1, 2022 10:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save douglasmiranda/6c78a82b71f626c8deb930bede6d7dfc to your computer and use it in GitHub Desktop.
Save douglasmiranda/6c78a82b71f626c8deb930bede6d7dfc to your computer and use it in GitHub Desktop.
Packaging Docker aarch64 for Debian Stretch. (On Packet.net)

Deploy a server to packet.net

Type 2A - Ubuntu 17.04

ssh into it.

Install Docker. (Yes we use Docker to build Docker)

This is a old docker, but It's good for us. apt install docker.io

git clone https://github.com/docker/docker-ce
cd docker-ce/
git checkout 17.07

Create the Dockerfile components/packaging/deb/debian-stretch/Dockerfile.aarch64

# https://github.com/meyskens/docker-ce-packaging/blob/c74614629d9fa569a000f4bb16888656a9b59577/deb/debian-stretch/Dockerfile.aarch64
FROM arm64v8/debian:stretch

# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list

RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev pkg-config vim-common libsystemd-dev gnupg dirmngr --no-install-recommends && rm -rf /var/lib/apt/lists/*

ENV GO_VERSION 1.8.5
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS apparmor seccomp selinux

COPY common/ /root/build-deb/debian
COPY build-deb /root/build-deb/build-deb

RUN mkdir -p /go/src/github.com/docker && \
        mkdir -p /go/src/github.com/opencontainers && \
        ln -snf /engine /root/build-deb/engine && \
        ln -snf /cli /root/build-deb/cli && \
        ln -snf /root/build-deb/engine /go/src/github.com/docker/docker && \
        ln -snf /root/build-deb/cli /go/src/github.com/docker/cli


ENV DISTRO debian
ENV SUITE stretch

WORKDIR /root/build-deb

ENTRYPOINT ["/root/build-deb/build-deb"]

Let's build!

make deb DOCKER_BUILD_PKGS=debian-stretch

Get your .deb at: components/packaging/deb/debbuild/debian-stretch/

$ ls components/packaging/deb/debbuild/debian-stretch/
docker-ce_17.10.0~ce-0~debian_arm64.buildinfo  docker-ce_17.10.0~ce-0~debian_arm64.changes  docker-ce_17.10.0~ce-0~debian_arm64.deb  docker-ce_17.10.0~ce-0~debian.dsc  docker-ce_17.10.0~ce-0~debian.tar.gz

Now, let's install our brand new Docker

(I'm installing on my Rock64 board)

# Since we don't have an aarch64 package (https://gist.github.com/douglasmiranda/41c582be2e216f09e1c1081a69e66f87)

wget https://github.com/douglas-archives/stuff/blob/master/docker-ce_17.10.0~ce-0~debian_arm64.deb?raw=true -O docker.deb

# Dependencies
apt-get install libapparmor1 libltdl7 libseccomp2

dpkg -i docker.deb
rm docker.deb
@douglasmiranda
Copy link
Author

screen shot 2017-11-03 at 17 07 54

@vielmetti
Copy link

nice!

@chestercs
Copy link

cool

@olihey
Copy link

olihey commented May 5, 2018

Awesome, thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment