Setting up a PXE Boot Server with Docker-Compose and boot Kali Linux (or other OSs)

Setting up a PXE Boot Server with Docker-Compose and boot Kali Linux

In this guide I try to explain how to set up a PXE Boot Server with Pi-Hole and Docker-Compose.

Host means the machine where docker is running.

I am working in the subdirectory: /home/user/container/pihole

I used as an example.

1. Mount a TFTP Folder in the Pi-Hole Container.

Go in in the folder where your Pi-Hole configuration is. In my case it is:

cd /home/user/container/pihole

Create a new folder called tftpboot with

mkdir tftpboot

Edit the docker-compose.yml and mount the tftpboot to pihole. Add - './tftpboot:/tftpboot/' in the Volume section.

Example docker-compose.yml file:

version: "3"

# More info at and
    container_name: pihole
    image: pihole/pihole:latest
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      TZ: 'America/Chicago'
      WEBPASSWORD: 'yourpw'
      ServerIP: ''
      IPv6: 'false'
      DNSMASQ_LISTENING: 'local'
      INTERFACE: 'enp5s0'
      DHCP_ACTIVE: 'true'
      DHCP_START: ''
      DHCP_END: ''
      DHCP_ROUTER: ''
    # Volumes store your data between container upgrades
      - './etc-pihole/:/etc/pihole/'
      - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
      - './tftpboot:/tftpboot/'
    # Recommended but not required (DHCP needs NET_ADMIN)
    network_mode: host
    restart: always
      - NET_ADMIN

2. Now we need to tell Pi-Hole to start the integrated TFTP Server.

Change in the etc-dnsmasq.d folder.

cd etc-dnsmasq.d

Create a file 99-pxeboot.conf and add the follwing content:

touch 99-pxeboot.conf && nano 99-pxeboot.conf

Add the following content to the file and save it once finished.

pxe-prompt="Press F8 for menu.", 60
pxe-service=x86PC,"Boot from local disk",0
pxe-service=x86PC,"Boot Kali Linux",kali/pxelinux

From here on you are done with Pi-Hole. The TFTP server should run, but it needs something to deliver to the clients.

3. Download the Netboot Image

Create a subdirectory for kali Linux in the tftp folder to provide the client with the data.

cd /home/user/container/pihole/tftpboot/ mkdir kali cd kali

Download Kali Linux.





Unzip and remove the Image:

tar -zxpf netboot.tar.gz rm netboot.tar.gz

4. Start Pi-Hole

You are all done. Start the Pi-Hole Container.

sudo docker-compose up -d
1 Like