Skip to content

lcford2/docker-manager

Repository files navigation

Docker Manager

A comprehensive web application for managing Docker containers, images, volumes, and networks with real-time monitoring and role-based access control.

Features

  • Real-time Monitoring: Live CPU, memory, and network statistics via WebSocket
  • Container Management: Start, stop, restart containers with detailed inspect views
  • Log Viewing: Real-time log streaming with filtering capabilities
  • Volume & Image Management: Inspect volumes and manage Docker images
  • Network Visualization: View and manage Docker networks
  • Role-based Authentication: Admin, operator, and viewer roles with granular permissions
  • Modern UI: Professional Material-UI interface designed for sys-admins
  • Dockerized Deployment: Complete containerized solution with Docker Compose

Architecture

  • Frontend: React TypeScript with Material-UI
  • Backend: Rust with Axum framework and WebSocket support
  • Database: PostgreSQL for user management and historical stats
  • Proxy: Nginx for reverse proxy and static file serving

Quick Start

Prerequisites

  • Docker and Docker Compose installed
  • At least 2GB RAM available
  • Port 8088 available on host

Installation

  1. Initialize configuration (first time only):
./scripts/init-config.sh

This creates your .env file with generated secrets and a default config.toml.

  1. Start the application:
docker-compose up -d
  1. Access the application:
  • Open http://localhost:8088 in your browser
  • Use the credentials you set in the .env file to login as admin

Development Setup

For local development without Docker:

# Start only database services
docker-compose up -d postgres

# Run Rust backend
cd backend
cargo run

# Run frontend (in another terminal)
cd frontend
npm install
npm start

Access the frontend at http://localhost:3000 (proxied to backend at http://localhost:6500).

Configuration

Docker Manager uses a simple, unified configuration system. See:

Key Files

File Purpose Version Control
backend/config/config.toml Your custom settings ✅ Commit (no secrets)
.env Secrets (JWT_SECRET, DB_PASSWORD) ❌ Never commit
backend/config.toml.template Template with defaults ✅ Commit

User Roles

  • Admin: Full access including user management
  • Operator: Container lifecycle management (start/stop/restart/logs/inspect)
  • Viewer: Read-only access (inspect/logs/stats only)

API Documentation

Once running, Swagger UI is available at:

Security Best Practices

  • ✅ Change default admin credentials on first login
  • ✅ Use strong JWT_SECRET (auto-generated by init script)
  • ✅ Keep .env file secure and never commit it
  • ✅ Restrict Docker socket access to authorized users only
  • ✅ Use HTTPS in production environments
  • ✅ Configure firewall rules for network access

Project Structure

Backend (Rust)

backend/src/
├── main.rs           # Entry point, server initialization
├── api.rs            # API router composition
├── lib/
│   ├── auth.rs       # Authentication backend
│   ├── config.rs     # Configuration loading
│   ├── docker.rs     # Docker client utilities
│   └── stats_workers.rs  # Background stats collection
└── api/
    ├── auth.rs       # Login/logout endpoints
    ├── websocket/    # WebSocket handlers
    └── docker/       # Docker resource endpoints

Frontend (React TypeScript)

frontend/src/
├── App.tsx           # Main app and routing
├── components/
│   ├── dashboard/    # System overview
│   ├── containers/   # Container management
│   ├── images/       # Image management
│   ├── networks/     # Network management
│   ├── volumes/      # Volume management
│   └── admin/        # User management
└── contexts/
    └── WebSocketContext.tsx  # Real-time data

Troubleshooting

Common Issues

Backend fails to start:

  • Check .env file exists and contains JWT_SECRET and DB_PASSWORD
  • Run ./scripts/init-config.sh if missing

Database connection errors:

  • Verify PostgreSQL container is running: docker-compose ps postgres
  • Check database credentials in .env

WebSocket connection failures:

  • Ensure backend is running and healthy
  • Check browser console for connection errors

Viewing Logs

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f postgres

License

MIT License - see LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published