1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-30 18:51:24 +00:00
dockerfiles/dnsmasq/pxe/README.md

99 lines
1.9 KiB
Markdown
Raw Normal View History

2016-06-20 13:33:42 +00:00
pxe
===
The Preboot Execution Environment (PXE) is an environment to bootstrap
computers using a network card (i.e Ethernet, Token-Ring) independently of
available data storage devices (like hard disks) or installed operating
systems.
## docker-compose.yml
2016-06-20 14:42:27 +00:00
2016-06-20 13:33:42 +00:00
```yaml
pxe:
image: vimagick/dnsmasq
2016-06-20 14:42:27 +00:00
net: host
2016-06-20 13:33:42 +00:00
volumes:
- ./dnsmasq.conf:/etc/dnsmasq.d/dnsmasq.conf
- ./tftpboot:/tftpboot
restart: always
2016-06-20 14:42:27 +00:00
web:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./html:/var/lib/nginx/html
restsart: always
2016-06-20 13:33:42 +00:00
```
2016-06-21 01:23:08 +00:00
> :warning: The local mirror doesn't work!
2016-06-20 13:33:42 +00:00
## dnsmasq.conf
```
interface=eth0
port=0
no-hosts
no-resolv
server=8.8.8.8
2016-08-07 00:51:52 +00:00
dhcp-range=192.168.1.10,192.168.1.20,1h,proxy
2016-06-20 13:33:42 +00:00
dhcp-option=3,192.168.1.1
dhcp-option=6,192.168.1.1
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/tftpboot
```
> You can get all `dhcp-option` codes via `dnsmasq --help dhcp`.
2016-06-20 14:42:27 +00:00
## nginx.conf
```
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
```
2016-06-20 13:33:42 +00:00
## up and running
```bash
cd ~/fig/pxe/
mkdir tftpboot
wget http://ftp.nl.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar xzf netboot.tar.gz -C tftpboot
2016-06-20 14:42:27 +00:00
mkdir html
wget http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-cd/debian-8.5.0-amd64-CD-1.iso
mount debian-8.5.0-amd64-CD-1.iso html
2016-06-20 13:33:42 +00:00
docker-compose up -d
docker-compose logs -f
```
2016-06-21 01:23:08 +00:00
> You should stop DHCP service on local network before starting PXE.
> Also take a look at `preseed.cfg` for unattended installation.