A lightweight, secure NFS server built on Alpine Linux.
2.4K
A lightweight, secure NFS server built on Alpine Linux, designed for Kubernetes environments with modular model storage architecture. Perfect for AI/ML workloads, microservices shared storage, and cloud-native applications.
Now available in two optimized variants:
Choose the right variant for your needs:
| Variant | Tag | Size | Python | NFSv4 | Kerberos | Best For |
|---|---|---|---|---|---|---|
| Standard | 1.0.2 | 62.8 MB | β Yes | β Yes | β Yes | Production, enterprise, full features |
| Slim | 1.0.2-slim | 22.7 MB | β No | β No (v3 only) | β No | Edge, IoT, CI/CD, size-critical |
# Basic NFS server with full features
docker run -d
--name nfs-server
--privileged
-e SHARE_NAME=mydata
-e CLIENT_CIDR=10.0.0.0/8
-p 2049:2049
-p 20048:20048
-p 111:111
-v /path/to/data:/nfsshare/data
boyroywax/nfs-server:1.0.2
version: '3.8'
services:
nfs-server:
image: boyroywax/nfs-server:1.0.2
privileged: true
environment:
- SHARE_NAME=mydata
- CLIENT_CIDR=10.0.0.0/8
ports:
- "2049:2049"
- "20048:20048"
- "111:111"
volumes:
- /path/to/data:/nfsshare/data
# Ultra-lightweight NFS server (NFSv3 only)
docker run -d
--name nfs-server-slim
--privileged
-e SHARE_NAME=mydata
-e CLIENT_CIDR=10.0.0.0/8
-p 2049:2049
-p 20048:20048
-p 111:111
-v /path/to/data:/nfsshare/data
boyroywax/nfs-server:1.0.2-slim
# Deploy to default namespace
kubectl apply -f https://raw.githubusercontent.com/boyroywax/nfs-server/main/examples/deployment.yaml
# Deploy to specific namespace
kubectl apply -f https://raw.githubusercontent.com/boyroywax/nfs-server/main/examples/deployment.yaml -n your-namespace
Clone the repository:
git clone https://github.com/boyroywax/nfs-server.git
cd nfs-server
Customize the deployment:
# Edit the deployment configuration
cp examples/deployment.yaml my-nfs-deployment.yaml
# Modify as needed...
Deploy:
kubectl apply -f my-nfs-deployment.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: nfs-server.default.svc.cluster.local
path: "/"
mountOptions:
- nfsvers=4.1
- proto=tcp
- hard
- intr
| Variable | Default | Description |
|---|---|---|
SHARE_NAME | default-share | NFS share identifier for logging and management |
EXPORT_PATH | /nfsshare/data | Path to export via NFS |
CLIENT_CIDR | 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 | Comma-separated list of allowed client networks |
NFS_OPTIONS | rw,sync,no_subtree_check,no_root_squash,insecure | NFS export options |
TZ | UTC | Timezone for logging |
rw - Read-write accesssync - Synchronous writes (safer but slower)no_subtree_check - Disable subtree checking for better performanceno_root_squash - Allow root access from clientsinsecure - Allow connections from ports > 1024For production environments, consider:
root_squash instead of no_root_squashCLIENT_CIDR to specific networksPerfect for serving large language models (LLaMA, Ollama, etc.) across multiple inference pods:
# Example: Shared model storage for Ollama
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama-llama32-1b
spec:
replicas: 3
template:
spec:
containers:
- name: ollama
image: ollama/ollama:latest
volumeMounts:
- name: models
mountPath: /models
volumes:
- name: models
nfs:
server: nfs-server.default.svc.cluster.local
path: "/"
Enable multiple services to share configuration, assets, or temporary files:
# Shared uploads directory
volumes:
- name: shared-uploads
nfs:
server: nfs-server.uploads.svc.cluster.local
path: "/"
Quick shared storage for development teams:
# Local development with docker-compose
docker-compose -f examples/docker-compose.dev.yaml up -d
nfsuser:1001)The examples/ directory contains various deployment scenarios:
deployment.yamlβ - Basic Kubernetes deploymentdeployment-with-pvc.yamlβ - With persistent volume claimdocker-compose.yamlβ - Docker Compose setupdocker-compose.dev.yamlβ - Development environmentai-model-storage/β - AI/ML model serving examplesPod not starting:
# Check if the namespace allows privileged containers
kubectl describe pod <pod-name>
# Check events
kubectl get events --sort-by='.lastTimestamp'
Mount failures:
# Test NFS connectivity from a debug pod
kubectl run -it --rm debug --image=busybox --restart=Never -- sh
# Inside the pod:
apk add nfs-utils
showmount -e <nfs-server-ip>
Permission denied:
# Check export configuration
kubectl exec <nfs-pod> -- cat /etc/exports
kubectl exec <nfs-pod> -- showmount -e localhost
For high-throughput workloads:
env:
- name: NFS_OPTIONS
value: "rw,async,no_subtree_check,no_root_squash,insecure"
For safety-critical workloads:
env:
- name: NFS_OPTIONS
value: "rw,sync,subtree_check,root_squash,secure"
The container includes built-in health checks:
# View NFS server logs
kubectl logs -f <nfs-pod-name>
# View export status
kubectl exec <nfs-pod> -- showmount -e localhost
Consider integrating with:
Contributions are welcome! Please feel free to submit a Pull Request.
Clone the repository:
git clone https://github.com/boyroywax/nfs-server.git
cd nfs-server
Build locally:
docker build -t nfs-server:dev .
Test:
docker-compose -f examples/docker-compose.dev.yaml up -d
# Create buildx builder
docker buildx create --name attestation-builder --driver docker-container --use
# Build with attestation and SBOM
docker buildx build
--builder attestation-builder
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
--build-arg VCS_REF="$(git rev-parse HEAD)"
--build-arg VERSION="1.0.1"
--platform linux/amd64
--attest type=provenance,mode=max
--attest type=sbom
-t boyroywax/nfs-server:dev
--push
.
This project is licensed under the MIT License - see the LICENSEβ file for details.
Built with β€οΈ for the cloud-native community.
For questions, issues, or contributions, please visit our GitHub repositoryβ .
Content type
Image
Digest
sha256:5110eed7aβ¦
Size
23.6 MB
Last updated
about 1 year ago
docker pull boyroywax/nfs-server