# TFTP 守护进程 基于 Alpine Linux 的轻量级容器化 TFTP 服务器,专为网络启动和文件服务场景设计。 ## 快速开始 ### 基础使用 使用本地目录挂载运行 TFTP 服务器: ```bash docker run -d \ -p 69:69/udp \ -v /path/to/tftpboot:/var/lib/tftpboot \ gitea.bcde.io/wangdefa/tftpd:latest ``` ### 启用 NetBoot.xyz 启用 netboot.xyz EFI 启动文件的自动下载: ```bash docker run -d \ -p 69:69/udp \ -e DOWNLOAD_NETBOOT_XYZ=true \ -v /path/to/tftpboot:/var/lib/tftpboot \ gitea.bcde.io/wangdefa/tftpd:latest ``` ## 配置 ### 环境变量 | 变量 | 说明 | 默认值 | |----------|-------------|---------| | `DOWNLOAD_NETBOOT_XYZ` | 启动时下载 netboot.xyz EFI 文件 | `false` | ### 卷挂载 | 容器路径 | 说明 | |----------------|-------------| | `/var/lib/tftpboot` | TFTP 服务的根目录 | ### 端口暴露 | 端口 | 协议 | 说明 | |------|----------|-------------| | 69 | UDP | TFTP 服务端口 | ## 使用场景 ### NetBoot.xyz 启动菜单 使用 netboot.xyz 提供网络启动菜单: ```bash docker run -d \ --name tftpd-netboot \ -p 69:69/udp \ -e DOWNLOAD_NETBOOT_XYZ=true \ -v /srv/tftp:/var/lib/tftpboot \ gitea.bcde.io/wangdefa/tftpd:latest ``` 这将自动下载: - `netboot.xyz.efi` - 用于 x86_64 UEFI 系统 - `netboot.xyz-arm64.efi` - 用于 ARM64 UEFI 系统 ### Docker Compose 创建 `docker-compose.yml` 文件: ```yaml version: '3.8' services: tftpd: image: gitea.bcde.io/wangdefa/tftpd:latest container_name: tftpd restart: unless-stopped ports: - "69:69/udp" volumes: - ./tftpboot:/var/lib/tftpboot environment: - DOWNLOAD_NETBOOT_XYZ=true ``` 然后运行: ```bash docker-compose up -d ``` ## 架构 ### 容器结构 ``` tftpd/ ├── Dockerfile # 容器定义 ├── entrypoint.sh # 初始化脚本 └── .gitea/ └── workflows/ └── ci.yaml # CI/CD 流水线 ```