A comprehensive Docker container scheduling tool has been created with the following components:
-
LocalDockerManager: Direct Docker daemon connection
- Get running/all containers
- Start/stop containers
- Error handling for local issues
-
RemoteDockerManager: SSH-based Docker management
- SSH connection with Paramiko
- Remote command execution
- Root/sudo access for Docker operations
- Connection management
- ScheduledTask: Dataclass for task representation
- ContainerScheduler: Background scheduler
- Schedule stop after delay (minutes)
- Schedule start at time + duration
- Background thread execution
- Task cancellation support
- Every 60-second check interval
- ContainerUI: Complete CLI application
- Connection setup (local/remote)
- Container listing with formatting
- Interactive container selection
- Schedule action prompting
- Task viewing
- Main application loop
- Simple launcher for the application
- Starts the ContainerUI
Complete user guide with:
- Feature overview
- Installation instructions
- Usage workflow
- Examples
- Troubleshooting
- Security notes
8 detailed scenarios:
- Local container stop-after delay
- Remote container start/stop scheduling
- Multiple containers scheduling
- Task monitoring
- SSH troubleshooting
- Docker Compose integration
- Development workflow
- Automated testing
Technical documentation:
- Architecture overview
- Component details
- Data flow diagrams
- Error handling
- Extension points
- Performance considerations
- Security best practices
Quick reference guide:
- Installation in 2 minutes
- Menu options
- Common tasks
- Troubleshooting checklist
- Symbols & output legend
All Python dependencies:
- docker (7.0.0)
- paramiko (3.4.0)
- schedule (1.2.0)
- python-dateutil (2.8.2)
- click (8.1.7)
- tabulate (0.9.0)
Package configuration for pip installation
Standard Python project ignores
Helper script for quick setup
✅ Local Docker daemon connection ✅ Remote SSH connection with password auth ✅ SSH credential prompting with secure input ✅ Connection validation and error handling
✅ List all containers (running + stopped) ✅ Get container details (ID, name, image, status) ✅ Start containers ✅ Stop containers ✅ Both local and remote execution
✅ Schedule container stop after N minutes ✅ Schedule container start at specific time ✅ Schedule duration for running containers ✅ Background thread scheduler ✅ 60-second check intervals ✅ Task persistence in memory ✅ View all scheduled tasks
✅ Interactive CLI with formatted output ✅ Table-based container display ✅ Input validation (time format, durations) ✅ Clear prompts and feedback ✅ Error messages with helpful context ✅ Professional formatting with symbols (🐳 🔌 📦 etc.)
cd d:\GitRepos\Containnap
pip install -r requirements.txtpython main.py- Choose local or remote connection
- View available containers
- Select a container
- Schedule an action:
- Running: Stop after X minutes
- Stopped: Start at HH:MM for X minutes
- Start the scheduler
- View scheduled tasks anytime
- docker_manager.py: All Docker operations
- scheduler.py: All scheduling logic
- ui.py: All user interaction
- main.py: Entry point only
- Easy to add new scheduling strategies
- Easy to add new Docker operations
- Easy to integrate with other systems
- Well-documented extension points
- Runs in background thread
- Doesn't block user interaction
- Can add more tasks while scheduler running
- Minimal CPU usage (checks every 60 seconds)
- Connection failures caught and reported
- Invalid input validated
- Container operations with error messages
- SSH credential validation
| Component | File | Lines | Purpose |
|---|---|---|---|
| Docker Manager | docker_manager.py | ~280 | Local & remote Docker operations |
| Scheduler | scheduler.py | ~180 | Task scheduling & execution |
| User Interface | ui.py | ~380 | Interactive CLI |
| Entry Point | main.py | ~20 | Application launcher |
| Total Code | ~860 | Core functionality | |
| Documentation | 5 files | ~800 | Comprehensive guides |
| Config | 4 files | ~100 | Setup & requirements |
- Stop dev containers after work hours
- Automatically free up resources
- Reduce power consumption
- Run test containers for fixed durations
- Auto-cleanup after tests complete
- No manual intervention needed
- Schedule maintenance windows
- Controlled container restarts
- Automated backup processes
- Manage multiple remote Docker hosts
- Centralized scheduling
- SSH-based secure access
✅ Secure password input (not echoed) ✅ SSH root/sudo requirement for remote ✅ Container operation validation ✅ Input sanitization ✅ Connection error handling ✅ No credential storage
Potential additions (documented in code):
- SSH key-based authentication
- Task persistence (JSON/Database)
- Email/Slack notifications
- Container health monitoring
- Cron expression support
- Docker Compose support
- Web dashboard
- Configuration file support
- Start with: QUICKSTART.md (5-min read)
- Examples: EXAMPLES.md (8 scenarios)
- Full guide: README.md (complete reference)
- Architecture: DEVELOPER.md (technical deep dive)
- Code: Read the source modules
- Extension: Add features to existing modules
- ✅ Local Docker connection works
- ✅ Remote SSH connection implementation
- ✅ Container listing (all & running)
- ✅ Container selection UI
- ✅ Schedule stop-after delay
- ✅ Schedule start-at-time with duration
- ✅ Background scheduler thread
- ✅ Task viewing
- ✅ Error handling throughout
- ✅ Professional UI with formatting
- ✅ Complete documentation
- ✅ Usage examples
- ✅ Developer documentation
- ✅ Quick reference guide
Containnap/
├── README.md ← User guide (start here!)
├── QUICKSTART.md ← 5-min quick reference
├── EXAMPLES.md ← 8 usage scenarios
├── DEVELOPER.md ← Technical documentation
├── main.py ← Run this: python main.py
├── requirements.txt ← pip install -r requirements.txt
├── setup.py ← Package configuration
├── install.sh ← Setup helper
├── .gitignore ← Git configuration
├── LICENSE ← Project license
└── containnap/ ← Main package
├── __init__.py ← Package init
├── docker_manager.py ← Local & remote Docker (280 lines)
├── scheduler.py ← Task scheduling (180 lines)
└── ui.py ← Interactive CLI (380 lines)
Total: ~860 lines of core code + ~800 lines of documentation
# 1. Install
cd d:\GitRepos\Containnap
pip install -r requirements.txt
# 2. Run
python main.py
# 3. Try it
- Select: 1 (Local) or 2 (Remote)
- View containers
- Schedule an action
- Start scheduler
- Done!For questions, refer to:
- Quick questions: QUICKSTART.md
- Usage examples: EXAMPLES.md
- Full documentation: README.md
- Technical details: DEVELOPER.md
Containnap is ready to manage your Docker containers! 🐳✨