├── Dockerfile ├── LICENSE └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:latest 2 | MAINTAINER nanert 3 | 4 | RUN yum install -y tftp-server syslinux wget 5 | RUN mkdir /srv/{centos7,pxelinux.cfg} 6 | RUN wget https://mirrors.xmission.com/centos/7/os/x86_64/images/pxeboot/vmlinuz -O /srv/centos7/vmlinuz 7 | RUN wget http://mirrors.xmission.com/centos/7/os/x86_64/images/pxeboot/initrd.img -O /srv/centos7/initrd.img 8 | RUN cp /usr/share/syslinux/{{mboot,menu,chain}.c32,pxelinux.0,memdisk} /srv 9 | RUN export TMPF=/srv/pxelinux.cfg/default && echo "default menu.c32" >> ${TMPF} && echo "prompt 0" >> ${TMPF} && echo "timeout 300" >> ${TMPF} && echo "ONTIMEOUT local" >> ${TMPF} && echo >> ${TMPF} && echo "menu title ##### PXE Boot Menu #####" >> ${TMPF} && echo "label 1" >> ${TMPF} && echo "menu label ^1) Install CentOS 7 (Online)" >> ${TMPF} && echo "kernel centos7/vmlinuz" >> ${TMPF} && echo "append initrd=centos7/initrd.img repo=http://mirror.centos.org/centos/7/os/x86_64/ devfs=nomount" >> ${TMPF} 10 | 11 | 12 | ENV LISTEN_IP=0.0.0.0 13 | ENV LISTEN_PORT=69 14 | 15 | ENTRYPOINT in.tftpd -s /srv -4 -L -a $LISTEN_IP:$LISTEN_PORT 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, nanert 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of docker-pxeboot nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## PXEBOOT 2 | 3 | An out-of-the-box start and use TFTP PXE server with CentOS 7 online installation pre-configured. You can also supply your own menu configuration, or even your own PXE boot image/environment for full customization. 4 | 5 | #### How to use 6 | 7 | For out-of-the-box running 8 | 9 | `$ docker pull nanert/pxeboot` 10 | `$ docker run -d --net=host --name=pxeboot nanert/pxeboot` 11 | 12 | Configure your DHCP server to give the container IP for next-server and pxelinux.0 as the filename. 13 | 14 | 15 | #### Advanced Use 16 | 17 | The Dockerfile is available [on Github](https://github.com/nanert/docker-pxeboot). 18 | 19 | nanert/pxeboot does not expose any ports for you. tftp/PXE uses UDP port 69 by default, but this is configurable in the container via environment variables. 20 | 21 | Supported environment variables: 22 | 23 | * **LISTEN_IP** - The IP address to listen on. Defaults to 0.0.0.0. 24 | 25 | * **LISTEN_PORT** - The UDP PORT to listen on. Defaults to 69. 26 | 27 | nanert/pxeboot only supports IPv4. If you need IPv6, you'll have to delve into man in.tftpd and the Dockerfile. 28 | 29 | Custom mount points for configurations: 30 | 31 | /srv - This is the tftp root that nanert/pxeboot uses. You can mount this to your own directory and provide any PXE images and configurations you want. 32 | 33 | /srv/pxelinux.cfg - nanert/pxeboot uses pxelinux.0 from the syslinux package. The "default" file in this directory holds the default menu config with a CentOS7 setup. You can mount only this folder and serve your own config files for custom menus and PXE boot options instead of overriding all of /srv, which requires you to provide your own pxe images. Images/files that are available are: mboot.c32, menu.c32, chain.c32, pxelinux.0, and memdisk. 34 | 35 | #### Issues 36 | 37 | I have had some trouble getting docker's proxy (port publishing or what have you) to work correctly when PXE booting with this image. The tftp server seems to be errant in it's behavior when going through the proxy (or the proxy is, who knows). Since troubleshooting things over UDP is even more annoying than TCP, I haven't delved much into it. Suffice to say if you need to PXE boot with this server via docker's proxy interface, YMMV (aka it won't work probably). If you get it working pls let me know how. I usually just give a LISTEN_IP and the --net=host to the instance and let it chill on my network PXE booting my things. 38 | 39 | --------------------------------------------------------------------------------