☞ use this compose: https://github.com/yangxuan8282/rpi3-pxe-docker , this is the working one
Last active
September 27, 2022 10:52
-
-
Save yangxuan8282/24e8d5ff70049afc7bb12a8f4a46e8b6 to your computer and use it in GitHub Desktop.
pi netboot with docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port=0 | |
dhcp-range=192.168.1.255,proxy | |
log-dhcp | |
enable-tftp | |
tftp-root=/tftpboot | |
pxe-service=0,"Raspberry Pi Boot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "2" | |
services: | |
netboot_boot: | |
image: local/dnsmasq | |
privileged: true | |
network_mode: "host" | |
volumes: | |
- ./boot:/tftpboot | |
- ./dnsmasq.conf:/etc/dnsmasq.conf | |
netboot_root: | |
image: local/nfs-server | |
privileged: true | |
network_mode: "host" | |
volumes: | |
# - ./exports:/etc/exports | |
- ./rootfs:/nfsshare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM arm32v6/alpine | |
RUN apk add --no-cache dnsmasq | |
EXPOSE 53/tcp \ | |
53/udp \ | |
67/udp | |
ENTRYPOINT ["dnsmasq", "--no-daemon", "--user=dnsmasq", "--group=dnsmasq"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM arm32v6/alpine | |
RUN apk --update --no-cache add bash nfs-utils \ | |
&& echo "/nfs/client1 *(rw,sync,no_subtree_check,no_root_squash)" | tee -a /etc/exports | |
COPY run_nfs /usr/bin/ | |
COPY exports /etc/exports | |
#VOLUME /nfs/client1 | |
ENTRYPOINT ["run_nfs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/nfsshare *(rw,sync,no_subtree_check,no_root_squash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
trap "stop; exit 0;" SIGTERM SIGINT | |
stop() | |
{ | |
# We're here because we've seen SIGTERM, likely via a Docker stop command or similar | |
# Let's shutdown cleanly | |
echo "SIGTERM caught, terminating NFS process(es)..." | |
/usr/sbin/exportfs -ua | |
pid1=$(pidof rpc.nfsd) | |
pid2=$(pidof rpc.mountd) | |
kill -TERM $pid1 $pid2 > /dev/null 2>&1 | |
echo "Terminated." | |
exit | |
} | |
mkdir -p /nfsshare | |
# Fixed nlockmgr port | |
#echo 'fs.nfs.nlm_tcpport=32768' >> /etc/sysctl.conf | |
#echo 'fs.nfs.nlm_udpport=32768' >> /etc/sysctl.conf | |
#sysctl -p > /dev/null | |
mount -t nfsd nfds /proc/fs/nfsd | |
rpcbind -w | |
rpc.nfsd -N 2 -V 3 -N 4 -N 4.1 8 | |
exportfs -arfv | |
rpc.statd | |
rpc.mountd -N 2 -V 3 -N 4 -N 4.1 -F |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
I just tried to get this working on my Pi and get this error message:
rpc.mountd: Bad path in mount request from 10.50.1.47: "1000:/nfsshare/root"
In addition to this, I get some errors of this kind:
I attempted to restart the docker container, but this didn't work either. The Kernel on the pi panicked. :/
Here is my approach (based on your repo and this gist)