samdbmg / dhcp-netboot.xyz

Docker container that acts as a ProxyDHCP server for netbooting
GNU General Public License v3.0
69 stars 18 forks source link

Can we see your Dockerfile & docker-compose file for hub/docker.com/samdbmg/dhcp-netboot.xyz:latest ? #13

Open williamblair333 opened 10 months ago

williamblair333 commented 10 months ago

I was watching your youtube video and think it's awesome although I'm unsure how it's all set up under the hood. I'd like to see what you've done and learn from / tailor it for me. Or point me to a good guide. Thanks.

zyssai commented 10 months ago

Hi. Long time that I have not managed with netboot, but it is always working. Hope this helps.

# TO DEPLOY:
# docker-compose -f docker-compose.yml up -d

version: "3.9"

########################### NETWORKS

  netbootxyz_network:
    external: true

########################### SERVICES
services:

    # Autoindex - Simple Directory Index
  autoindex:
    container_name: autoindex
    image: dceoy/nginx-autoindex:latest
    restart: unless-stopped
    networks:
      netbootxyz_network:
        ipv4_address: $AUTOINDEX_IP
    ports:
      - "$AUTOINDEX_PORT:80"
    environment:
      - TZ=$TZ
      - PUID=$PUID
      - PGID=$PGID
    volumes:
      - $PXEDIR:/var/lib/nginx/html:ro # Location you want to index
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

  # NETBOOTXYZ PXE NETWORK BOOT MANAGEMENT
#
# CREATE NETWORK BEFORE WITH THIS COMMAND (EDIT NETWORK INTERFACE):
# docker network create --driver=ipvlan --gateway=192.168.0.254 --subnet=192.168.0.2/24 --ip-range=192.168.0.100/32 -o parent=enp4s0 netbootxyz_network
#
# if error with menus.tar.gz, run this:
# docker exec -it netbootxyz /bin/bash
# cd tmp
# wget https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.57/menus.tar.gz
#
# TO ACCESS ASSETS FROM BOOTED COMPUTER, USE THIS URL:
# HTTP://192.168.0.xxx (IP from autoindex container)
#
# TO MAKE THIS PERMANENT, EDIT ./netbootxyz/config/menus/boot.cfg
# set win_base_url http://192.168.0.xxx (IP from autoindex container)

#
  netbootxyz:
    container_name: netbootxyz
    image: samdbmg/dhcp-netboot.xyz:latest
    environment:
      - TZ=$TZ
      - PUID=$PUID
      - PGID=$PGID
      - DHCP_RANGE_START=$SUBNET
    restart: unless-stopped
    networks:
      netbootxyz_network:
        ipv4_address: $CONTAINER_IP
    ports:
      - 3000:3000
      - 69:69/udp
#      - 8080:80 #optional
    cap_add:
      - NET_ADMIN
    volumes:
      - $DOCKERDIR/netbootxyz:/etc/netbootxyz
      - $DOCKERDIR/netbootxyz/config:/config
      - $PXEDIR:/assets

And .env file


##### PORTS

AUTOINDEX_PORT=80
AUTOINDEX_IP=192.168.0.251

##### SYSTEM
PUID=1000
PGID=1000
TZ=Europe/Paris
SERVER_IP=192.168.0.40
LOCAL_NETWORK=192.168.0.0/24
NETWORK_INTERFACE=enp4s0

#NETBOOTXYZ
GATEWAY=192.168.0.254
SUBNET=192.168.0.2
SUBNET_PREFIX_BITS=24
CONTAINER_IP=192.168.0.250
IP_RANGE=192.168.0.252/32

##### FOLDERS
USERDIR=/home/xxxxxx
DOCKERDIR=/home/xxxxxx/docker
PXEDIR=/mnt/HDD4/PXE/assets
samdbmg commented 10 months ago

@zyssai has a nice practical example and some tips, https://github.com/samdbmg/dhcp-netboot.xyz/blob/main/docker-compose.yml should serve as a useful minimal example, but pay attention to the notes in https://github.com/samdbmg/dhcp-netboot.xyz#option-2-docker-compose or their Compose file above about setting up networking.

As for the Dockerfile, it's https://github.com/samdbmg/dhcp-netboot.xyz/blob/main/Dockerfile - GitHub Actions builds that and pushes it to Docker Hub at https://hub.docker.com/r/samdbmg/dhcp-netboot.xyz