A robust file sharing system demonstrating persistent storage using Docker volumes between host and container. This project showcases how Docker volumes maintain data persistence across container lifecycles.
This system provides an interactive menu-based interface for sharing files and folders between a Docker container and the host system, using Docker volumes for persistent storage. The project demonstrates key Docker concepts including containerization, volume mounting, and data persistence.
- ✅ Docker Volume Persistence - Data survives container restarts
- ✅ Interactive Menu System - User-friendly command-line interface
- ✅ File & Folder Operations - Send, receive, and manage files
- ✅ Cross-Platform Compatibility - Works on any system with Docker
- ✅ Automated Volume Management - Docker handles storage automatically
Host Machine (Debian VM) ←→ Docker Container ←→ Docker Volumes ↓ ↓ ↓ Debian OS File Sharing System Persistent Storage (Interactive Menu) (file_share_data, incoming_data, logs_data)
| Aspect | Traditional Approach | Docker Volumes |
|---|---|---|
| Persistence | Manual backup required | Automatic persistence |
| Portability | Platform-dependent | Cross-platform |
| Isolation | Direct host access | Containerized isolation |
| Setup | Complex configuration | Simple Docker commands |
| Scalability | Limited | Easily scalable |
- 🔒 Data Safety: Files persist even if container crashes or is deleted
- ⚡ Performance: Direct volume access without network overhead
- 🔧 Simplicity: No complex shared folder configurations needed
- 📦 Portability: Works on any system with Docker installed
- 🔄 Version Control: Entire system can be version-controlled via GitHub
- Docker - Containerization platform
- Docker Compose - Container orchestration
- Debian Linux - Base operating system
- Bash Scripting - Interactive menu system
- Docker Volumes - Persistent storage mechanism
Before installation, ensure you have:
- Docker Engine (version 20.10.0 or higher)
- Docker Compose (version 2.0.0 or higher)
- Linux environment (tested on Debian 13)
bash
sudo apt update && sudo apt upgrade -y
sudo apt install docker.io -y
sudo apt install docker-compose -y
sudo usermod -aG docker $USER newgrp docker
docker --version docker-compose --version
bash
git clone https://github.com/HamzaButt22/file-sharing-system.git cd file-sharing-system
chmod +x scripts/*
docker-compose build docker-compose up -d
bash
mkdir file-sharing-system cd file-sharing-system
mkdir scripts
chmod +x scripts/* docker-compose build docker-compose up -d
bash
cd file-sharing-system
docker-compose up -d
docker exec -it file-sharing-container /app/combined_menu
===== DOCKER FILE SHARING SYSTEM =====
- Send a File
- Send a Folder
- Receive a File
- Receive a Folder
- Delete Sent Item
- View Docker Volumes
- Exit
- Choose Option 1 from menu
- Enter file path: /etc/hosts or ~/Documents/test.txt
- File is copied to Docker volume and persists across restarts
- Choose Option 3 from menu
- Select from available files in shared volume
- File is copied to incoming volume
- Choose Option 6 from menu
- View all files in Docker volumes
- Verify persistence after container restart
bash
docker-compose up -d
docker exec -it file-sharing-container /app/combined_menu
docker-compose down
docker volume ls
docker-compose up -d
docker exec -it file-sharing-container /app/combined_menu
bash
for i in {1..5}; do echo "Test iteration $i" docker-compose down docker-compose up -d docker exec -it file-sharing-container ls -la /shared_volume sleep 2 done
file-sharing-system/ ├── Dockerfile # Container definition ├── docker-compose.yml # Orchestration configuration ├── scripts/ # Bash script files │ ├── combined_menu # Main interactive menu │ ├── sendfile # File sending functionality │ ├── sendfolder # Folder sending functionality │ ├── receivefile # File receiving functionality │ └── receivefolder # Folder receiving functionality ├── README.md # This documentation └── .gitignore # Git ignore rules
/shared_volume # Files available for sharing /incoming_volume # Received files storage /logs_volume # Operation logs and history
bash
docker-compose logs
docker-compose down -v docker-compose build --no-cache docker-compose up -d
bash
sudo usermod -aG docker $USER newgrp docker
chmod +x scripts/*
bash
docker volume ls docker volume inspect file_sharing_system_file_share_data
sudo ls -la /var/lib/docker/volumes/file_sharing_system_file_share_data/_data
bash
docker ps docker stats
docker exec -it file-sharing-container ls -la /shared_volume
docker logs file-sharing-container
- File Transfer Speed: Limited only by disk I/O
- Concurrent Operations: Supports multiple simultaneous operations
- Volume Scalability: Volumes automatically scale with storage needs
- Memory Usage: ~50MB (minimal overhead)
- CPU Usage: Negligible during idle state
- Storage Efficiency: Only stores actual file data
Modify docker-compose.yml for custom volume paths:
yaml services: file-sharing-app: # ... existing config ... volumes: - /custom/host/path:/shared_volume # Custom host path - incoming_data:/incoming_volume - logs_data:/logs_volume
bash
docker-compose up -d --scale file-sharing-app=3
bash
docker run --rm -v file_sharing_system_file_share_data:/volume -v $(pwd):/backup alpine
tar czf /backup/backup.tar.gz -C /volume ./
docker run --rm -v file_sharing_system_file_share_data:/volume -v $(pwd):/backup alpine
sh -c "rm -rf /volume/* && tar xzf /backup/backup.tar.gz -C /volume"
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch: git checkout -b feature/amazing-feature
- Commit changes: git commit -m 'Add amazing feature'
- Push to branch: git push origin feature/amazing-feature
- Open a Pull Request
bash
git clone https://github.com/HamzaButt22/file-sharing-system.git cd file-sharing-system
git checkout -b development
docker-compose up -d docker exec -it file-sharing-container /app/combined_menu
This project is licensed under the MIT License - see the LICENSE file for details.
- Docker Inc. for the excellent containerization platform
- Debian Project for the stable Linux distribution
- The open-source community for continuous inspiration
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Search existing Issues
- Create a new issue with detailed description
bash
git clone https://github.com/HamzaButt22/file-sharing-system.git cd file-sharing-system docker-compose up -d
docker exec -it file-sharing-container /app/combined_menu
docker-compose down docker-compose up -d docker exec -it file-sharing-container /app/combined_menu
docker volume ls docker volume inspect file_sharing_system_file_share_data
- ✅ Persistence: Files survive container lifecycle
- ✅ Isolation: Containerized environment
- ✅ Ease of Use: Simple menu interface
- ✅ Portability: Works on any Docker-supported system
Happy File Sharing! 🎉