Skip to content

Instantly share code, notes, and snippets.

@yankcrime
Created October 19, 2017 22:16
Show Gist options
  • Save yankcrime/7a7a39d07d6509f9a5b612a495028ae7 to your computer and use it in GitHub Desktop.
Save yankcrime/7a7a39d07d6509f9a5b612a495028ae7 to your computer and use it in GitHub Desktop.
Dockerfile for network booting ARM64 machines
FROM ubuntu:xenial
ENV ARCH arm64
ENV DIST xenial
ENV MIRROR http://ports.ubuntu.com
RUN apt-get -q update
RUN apt-get -qy install dnsmasq iptables curl
RUN curl -o /pipework https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework
RUN chmod +x pipework
RUN mkdir /tftp
WORKDIR /tftp
RUN curl -o /tmp/netboot.tar.gz $MIRROR/ubuntu-ports/dists/xenial/main/installer-arm64/current/images/netboot/netboot.tar.gz
RUN tar zxf /tmp/netboot.tar.gz -C /tftp
CMD \
echo Setting up iptables... &&\
iptables -t nat -A POSTROUTING -j MASQUERADE &&\
echo Waiting for pipework to give us the eth1 interface... &&\
/pipework --wait &&\
myIP=$(ip addr show dev eth1 | awk -F '[ /]+' '/global/ {print $3}') &&\
mySUBNET=$(echo $myIP | cut -d '.' -f 1,2,3) &&\
echo Starting DHCP+TFTP server...&&\
dnsmasq --interface=eth1 \
--dhcp-range=$mySUBNET.101,$mySUBNET.199,255.255.255.0,1h \
--dhcp-boot=ubuntu-installer/arm64/bootnetaa64.efi \
--enable-tftp --tftp-root=/tftp/ --no-daemon
@yankcrime
Copy link
Author

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