A distributed container orchestration platform that provides on-demand Ubuntu instances accessible via SSH. Think AWS EC2, but built with Docker containers and designed for simplicity.
DockHost allows users to spawn, manage, and access containerized Ubuntu environments through a web interface. Each instance runs in an isolated Docker container with full SSH access, HTTP/HTTPS port forwarding, and persistent storage until deletion.
The platform consists of three main components:
- Frontend: Web interface for instance management
- Main Server: Orchestration layer handling user requests and backend coordination
- Backend Machines: Worker nodes that host the actual containers
┌─────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Frontend │────│ Main Server │────│ Backend Machines│
│ (Next.js) │ │ (Express + │ │ (Docker + │
│ │ │ Socket.io │ │ Containers) │
└─────────────┘ │ + MongoDB) │ └─────────────────┘
└───────|──────┘
|
| ┌─────────────────┐
| │ Backend Machines│
.──────── | (Docker + │
│ Containers) │
└─────────────────┘
- User Registration: Users create accounts through the web interface
- Backend Registration: Backend machines connect to the main server using API keys
- Instance Creation: Users request instances, main server selects available backend
- Container Deployment: Backend creates Ubuntu container with SSH access
- SSH Access: Users connect via SSH using provided credentials and port mapping
- Distributed Architecture: Multiple backend machines for horizontal scaling
- SSH Access: Full terminal access to Ubuntu containers
- Port Mapping: Automatic allocation of SSH (22), HTTP (80), and HTTPS (443) ports
- Instance Management: Start, stop, delete operations via web interface
- Data Persistence: Container data persists through stop/start cycles
- Real-time Communication: WebSocket-based coordination between components
- Docker and Docker Compose
- Node.js 18+
- MongoDB (handled by Docker Compose)
- Clone the repository:
git clone https://github.com/sohampirale/DockHostV2.git
cd DockHostV2- Start the main services:
docker-compose up -dThis starts:
- Main server on
http://localhost:3001 - Frontend on
http://localhost:3000 - MongoDB database
- Access the web interface at
http://localhost:3000
- Register a backend through the web interface
- Get your DOCKHOST_API_KEY key from the dashboard
- Run the backend service:
# On the backend machine
cd backend
npm install
DOCKHOST_API_KEY=your_api_key
npm run build
npm startThe backend will automatically connect to your main server and be available for container deployment.
- Sign up/Login to the web interface
- Click "Create Instance"
- Provide your SSH public key
- Wait for deployment (typically 30-60 seconds)
- Use the provided SSH command to connect
ssh -p 1024 root@your-backend-ipPort numbers are automatically assigned (SSH: 1024, HTTP: 1025, HTTPS: 1026 in this example).
Ports numbers will change as multiple instances are spawned in a backend.
- Start: Resume a stopped instance
- Stop: Pause instance (data preserved)
- Delete: Permanently remove instance and all data
- Base Image:
sohampirale/instance(Ubuntu with SSH pre-configured) - SSH Access: Automatic authorized_keys setup
- Port Exposure: 22 (SSH), 80 (HTTP), 443 (HTTPS)
- Storage: Writable container filesystem
Backend machines connect to the main server via WebSocket (Socket.io) using API key authentication. The main server maintains real-time awareness of:
- Available backend machines
- Container status and resource usage
- Port allocation across backends
Each backend automatically manages port allocation:
- Finds 3 consecutive available ports
- Maps container ports 22, 80, 443 to host ports
- Handles port conflicts and reuse
dockhost/
├── frontend/ # Next.js web interface
├── main-server/ # Express orchestration server
├── backend/ # Backend machine service
├── compose.yml # Main services setup
└── README.md # This file
Each component has its own development setup. See individual README files:
- Volume Support: Persistent storage across container recreations
- Global Tunneling: Integration with ngrok for public access
- Resource Limits: CPU/memory constraints per container
- Multi-OS Support: Additional container images beyond Ubuntu
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For issues, questions, or contributions, please open an issue on GitHub or contact @sohampirale.
Built with ❤️ by Soham Pirale