Code Monkey home page Code Monkey logo

docker-tftp-hpa's Introduction

tftp-hpa (tftpd) in a container

Download size  Version  Source code  Docker Registry  Circle CI

Project URL: https://github.com/jumanjihouse/docker-tftp-hpa

Registry: https://registry.hub.docker.com/u/jumanjiman/tftp-hpa/

Overview

This source is used to build an image for tftp-hpa. The image contains:

  • H. Peter Anvin's tftp server
  • default, minimal configuration that you can easily override
  • syslinux files suitable for a PXE server
  • map file to rewrite certain request paths

The runtime image is quite small (roughly 9 MB) since it is based on Alpine Linux.

The goal is to provide a compromise between a single, monolithic tftpd image that contains all the things and a flexible tftpd image that contains just enough to combine with custom-built data containers or volumes an organization needs to bootstrap their infrastructure.

⚠️ The version of the image is tied to the version of tftp-hpa as of 2020-January. Previously the version was tied to syslinux.

Build integrity and docker tags

An unattended test harness runs the build script and acceptance tests. If all tests pass on master branch in the unattended test harness, circleci pushes the built image to the Docker hub.

The CI scripts on circleci apply two tags before pushing to docker hub:

  • jumanjiman/tftp-hpa:latest: latest successful build on master branch
  • jumanjiman/tftp-hpa:<date>T<time>-git-<git-hash>: a particular build on master branch

Therefore you can docker pull a specific tag if you don't want latest.

How-to

Fetch an already-built image

The runtime image is published as jumanjiman/tftp-hpa.

docker pull jumanjiman/tftp-hpa

List files in the image

The image contains the typical syslinux, efi, and pxelinux files from syslinux 6.0.3 at /tftpboot/. List them with:

docker run --rm -t \
  --entrypoint=/bin/sh \
  jumanjiman/tftp-hpa -c "find /tftpboot -type f"

Load NetFilter modules

Add helpers to track connections:

sudo modprobe nf_conntrack_tftp
sudo modprobe nf_nat_tftp

Configure and run

The published image contains just enough files to provide a base tftpd to PXE-boot your hosts to a simple menu. The simple menu and pxelinux.cfg/default only allow to skip PXE. Therefore you probably want to override the built-in menu.

Run a container with your own pxelinux.cfg files:

docker run -d -p 69:69/udp \
  -v /path/to/your/pxelinux.cfg:/tftpboot/pxelinux.cfg:ro \
  jumanjiman/tftp-hpa

Run a container with your own pxelinux.cfg and map files:

docker run -d -p 69:69/udp \
  -v /path/to/your/pxelinux.cfg:/tftpboot/pxelinux.cfg:ro \
  -v /path/to/your/mapfile:/tftpboot/rules/default:ro \
  jumanjiman/tftp-hpa

Use multiple volumes to add site-local boot files and menus in addition to the built-in syslinux files:

docker run -d -p 69:69/udp \
  -v /path/to/your/pxelinux.cfg:/tftpboot/pxelinux.cfg:ro \
  -v /path/to/your/bootfiles:/tftpboot/site:ro \
  jumanjiman/tftp-hpa

Use systemd for automatic startup

Review and potentially modify the sample systemd unit file at systemd/tftp-hpa.service, then run:

sudo cp systemd/tftp-hpa.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start tftp-hpa
sudo systemctl enable tftp-hpa

Build

On a docker host, run:

ci/build
ci/test

Publish to a private registry

You can push the built image to a private docker registry:

docker tag tftp-hpa registry_id/your_id/tftp-hpa
docker push registry_id/your_id/tftp-hpa

Contribute

See CONTRIBUTING.md in this repo.

License

See LICENSE in this repo.

docker-tftp-hpa's People

Contributors

jumanjiman avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-tftp-hpa's Issues

deployment in K8S... don't get it.

Hi
I am trying to use your container inside K8S, but I don't get it.
Here is my deployment file:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: tftp-nfs
  namespace: ftpsvc
  labels:
    app.name: tftpd
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 4Gi
  volumeName: tftp-nfs
  volumeMode: Filesystem
---
apiVersion: v1
kind: Service
metadata:
  name: tftpd
  namespace: ftpsvc
  labels:
    app.name: tftpd
spec:
  type: LoadBalancer
  loadBalancerIP: 192.168.1.199
  ports:
    - port: 69
      targetPort: tftpd
      protocol: UDP
      name: tftpd
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tftpd
  namespace: ftpsvc
  labels:
    app.name: tftpd
spec:
  replicas: 1
  selector:
    matchLabels:
      app.name: tftpd
  template:
    metadata:
      labels:
        app.name: tftpd
    spec:
      containers:
        - name: tftpd
          image: jumanjiman/tftp-hpa:latest
          imagePullPolicy: Always
          ports:
            - name: tftpd
              containerPort: 69
              protocol: UDP
          resources:
            limits:
              cpu: 100m
              memory: 128Mi
            requests:
              cpu: 100m
              memory: 128Mi
          volumeMounts:
            - name: tftp-nfs
              mountPath: /tftpboot
              readOnly: false
      volumes:
        - name: tftp-nfs
          persistentVolumeClaim:
            claimName: tftp-nfs

So basically, trying to mount in /tftpboot on my NFS mount.
Did you ever try it in K8S?
Do you have a sample deployment file?
Thanks

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

circleci
.circleci/config.yml
  • jumanjiman/cci 20200129.1700
docker-compose
docker-compose-metadata.yaml
docker-compose.yaml
dockerfile
client/Dockerfile
  • alpine 3.12.0
src/Dockerfile
  • alpine 3.12.0
pip_requirements
ci/requirements.txt
  • pre-commit ==2.6.0

  • Check this box to trigger a request for Renovate to run again on this repository

Tftp not reachable

Hello,

I just tried pulling and running the container with an example file. When I tried to tftp localhost and get test.cfg I just get a timeout.

Apparently the connection from host to port 69 works but the tftp does not send any response.

Do you have any tips?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.