mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
dockerfiles: Add dnsmasq image for general baremetal use
This commit is contained in:
19
README.md
19
README.md
@@ -12,6 +12,7 @@ Boot configs (kernel, options) and cloud configs can be defined for machines wit
|
||||
Pull the container image
|
||||
|
||||
docker pull quay.io/dghubble/bootcfg:latest
|
||||
docker tag quay.io/dghubble/bootcfg:latest dghubble/bootcfg:latest
|
||||
|
||||
or build the binary from source.
|
||||
|
||||
@@ -22,7 +23,7 @@ Next, prepare a [data config directory](#configs) or use the example in [data](d
|
||||
|
||||
Run the application on your host or as a Docker container with flag or environment variable [arguments](docs/config.md).
|
||||
|
||||
docker run -p 8080:8080 --name=bootcfg --rm -v $PWD/data:/data -v $PWD/images:/images dghubble/bootcfg:latest -address=0.0.0.0:8080
|
||||
docker run -p 8080:8080 --name=bootcfg --rm -v $PWD/data:/data:Z -v $PWD/images:/images dghubble/bootcfg:latest -address=0.0.0.0:8080
|
||||
|
||||
You can quickly check that `/ipxe?uuid=val` and `/pixiecore/v1/boot/:mac` serve the expected boot config and `/cloud?uuid=val` serves the expected cloud config. Proceed to [Networking](#networking) for discussion about connecting clients to your new boot config service.
|
||||
|
||||
@@ -96,16 +97,20 @@ To use the hosted images, tweak `kernel` and `initrd` in a boot config file. For
|
||||
|
||||
## Networking
|
||||
|
||||
The boot config service can be validated in PXE, iPXE, and Pixiecore scenarios using a libvirt virtual network with VM or bare metal PXE clients.
|
||||
Use PXE, iPXE, or Pixiecore with `bootcfg` to define kernel boot images, options, and cloud configs for machines within your network.
|
||||
|
||||
An ethernet bridge can be used to connect container services and VM or bare metal boot clients on the same network. Docker starts containers with virtual ethernet connections to the `docker0` bridge
|
||||
To get started in a libvirt development environment (under Linux), you can run the `bootcfg` container on the docker0 virtual bridge, alongside either the included `ipxe` conatainer or `danderson/pixiecore` and `dhcp` containers. Then you'll be able to boot libvirt VMs on the same bridge or baremetal PXE clients that are attatched to your development machine via a network adapter and added to the bridge. `docker0` defaults to subnet 172.17.0.0/16. See [clients](#clients).
|
||||
|
||||
$ brctl show
|
||||
$ docker network inspect bridge # docker client names the bridge "bridge"
|
||||
List all your bridges with
|
||||
|
||||
which uses the default subnet 172.17.0.0/16. Rather than reconfiguring Docker to start containers on a user defined bridge, it is easier to attach VMs and bare metal machines to `docker0`.
|
||||
brctl show
|
||||
|
||||
Start the container services specific to the scenario you wish to test, following the sections on PXE, iPXE, and Pixiecore below. Then create a client.
|
||||
and on docker 1.9+, you may inspect the bridge and its interfaces with
|
||||
|
||||
docker network inspect bridge # docker calls the bridge "bridge"
|
||||
|
||||
|
||||
To get started on a baremetal, run the `bootcfg` container with the `--net=host` argument and configure PXE, iPXE, or Pixiecore. If you do not yet have any of these services running on your network, the [dnsmasq image](dockerfiles/dnsmasq) can be helpful.
|
||||
|
||||
### iPXE
|
||||
|
||||
|
||||
8
dockerfiles/dnsmasq/Dockerfile
Normal file
8
dockerfiles/dnsmasq/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM alpine:latest
|
||||
MAINTAINER Dalton Hubble <dalton.hubble@coreos.com>
|
||||
RUN apk -U add dnsmasq curl
|
||||
RUN mkdir -p /var/lib/tftpboot
|
||||
RUN curl -s -o /var/lib/tftpboot/undionly.kpxe http://boot.ipxe.org/undionly.kpxe
|
||||
RUN ln -s /var/lib/tftpboot/undionly.kpxe /var/lib/tftpboot/undionly.0
|
||||
EXPOSE 53
|
||||
ENTRYPOINT ["dnsmasq", "-d"]
|
||||
17
dockerfiles/dnsmasq/README.md
Normal file
17
dockerfiles/dnsmasq/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
Use this container image to run the `dnsmasq` command on a host, in an isolated container which includes iPXE's undionly.kpxe boot file.
|
||||
|
||||
## Usage
|
||||
|
||||
Build the image
|
||||
|
||||
./docker-build
|
||||
|
||||
Run `dnsmasq` on a host in proxyDHCP mode to chainload iPXE.
|
||||
|
||||
docker run --net=host --rm --cap-add=NET_ADMIN coreos/dnsmasq -d -i enp0s25 --dhcp-range=192.168.86.0,proxy,255.255.255.0 --enable-tftp --tftp-root=/var/lib/tftpboot --dhcp-userclass=set:ipxe,iPXE --pxe-service=tag:#ipxe,x86PC,"PXE chainload to iPXE",undionly.kpxe
|
||||
|
||||
|
||||
|
||||
|
||||
5
dockerfiles/dnsmasq/docker-build
Executable file
5
dockerfiles/dnsmasq/docker-build
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
REPO=coreos/dnsmasq
|
||||
|
||||
docker build -q --rm=true -t $REPO:latest .
|
||||
Reference in New Issue
Block a user