Skip to content

Instantly share code, notes, and snippets.

@lalyos
Last active July 12, 2017 08:22
Show Gist options
  • Save lalyos/e9004a76aea6a0681ed6 to your computer and use it in GitHub Desktop.
Save lalyos/e9004a76aea6a0681ed6 to your computer and use it in GitHub Desktop.
Build alpine docker image for raspberry pi

There is no official alpine Docker image for the arm platform. The onec i found are not taking advantage of the much quicker Fastly CDN basedpackage mirror option

build

Here are steps to rebuild the images on a rpi:

git clone https://github.com/gliderlabs/docker-alpine.git docker-alpine-gliderlabs
cd docker-alpine-gliderlabs/

# the "builder" images has to be FROM an rpi based alpine
sed -i "/FROM/ s:.*:FROM hypriot/rpi-alpine-scratch:" builder/Dockerfile
docker build -t alpine-builder builder

# build library alpine
docker run --name alpine-build-v3.2 alpine-builder -s -t UTC -r v3.2 -m http://dl-4.alpinelinux.org/alpine > ./versions/library-3.2/rootfs.tar.gz
docker build -t alpine:latest versions/library-3.2

# build gliderlabs/alpine
docker rm alpine-build-v3.2
docker run --name alpine-build-v3.2 alpine-builder -s -c -t UTC -r v3.2 -m http://alpine.gliderlabs.com/alpine > ./versions/gliderlabs-3.2/rootfs.tar.gz
docker  build -t gliderlabs/alpine:latest versions/gliderlabs-3.2

need for speed

Lets see how much time is needed to install curl: 4sec instead of 15sec

$ time (docker run  alpine apk add -U  curl > /dev/null) 
real    0m15.916s

$ time (docker run  gliderlabs/alpine apk add -U  curl > /dev/null) 
real    0m4.225s
@thoralfliersch
Copy link

$ time (docker run alpine apk add -U curl > /dev/null)
0,02s user 0,01s system 0% cpu 3,376 total

$ time (docker run gliderlabs/alpine apk add -U curl > /dev/null)
0,02s user 0,01s system 0% cpu 3,503 total

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