[TriLUG] ARM Docker containers

Bill Farrow via TriLUG trilug at trilug.org
Thu Dec 28 10:29:52 EST 2017


Hey Guys,
Mike asked me a question via Meetup, but I thought my response might be of
interest to others. The slides I used for the lightning talk don't contain
the nitty gritty details. These are some notes of the process I use, and I
hope I haven't missed any steps. Hope this helps you get started.

1. Create the debian rootfs for ARM using chroot (runs as x86)

ROOTFS=jessie-rootfs
mkdir -p $ROOTFS
debootstrap --foreign --arch armel jessie $ROOTFS
http://ftp.debian.org/debian/
cp -a /usr/bin/qemu-arm-static $ROOTFS/usr/bin

2. Run the second stage of the bootstrap using QEMU armel emulation in
chroot
mount -t proc proc $ROOTFS/proc/
mount -t sysfs sysfs $ROOTFS/sys
chroot $ROOTFS /debootstrap/debootstrap --second-stage

3. Finish up some packaging configs, maybe do some extra stuff here if you
want
touch $ROOTFS/etc/mtab
mount --bind /dev $ROOTFS/dev
mount --bind /dev/pts $ROOTFS/dev/pts
mount -t proc proc $ROOTFS/proc/
mount -t sysfs sysfs $ROOTFS/sys
chroot $ROOTFS dpkg --configure -a

4. Create a docker image from the rootfs
tar zcf ${ROOTFS}.tgz $ROOTFS
docker import -c "CMD exec /bin/bash" ${ROOTFS}.tgz


Bill


More information about the TriLUG mailing list