DockHostV2 — Distributed Container Orchestration Platform
Architected a cloud developer platform providing on-demand Ubuntu container instances with SSH terminal access and dynamic port mapping.
Overview
DockHostV2 is a lightweight cloud hosting platform. Users can provision isolated Docker container environments, stream live interactive terminal sessions via WebSockets/Socket.io, and expose ports for web apps.
Problem
Developers need rapid, isolated sandbox environments for testing and deployment without waiting for slow VM startup times or incurring high cloud bills.
Constraints
- Real-time bidirectional terminal streaming with zero perceptible latency
- Isolated container networks with port mapping for 22 (SSH), 80, and 443
- Multi-worker node management controlled by a central web dashboard
Approach
Built a Next.js control plane UI, an Express backend API server, and worker node agents communicating over Socket.io. Managed container lifecycles via the Docker Engine API.
Key Decisions
Use Socket.io over raw WebSockets for control plane-to-worker communication
Built-in reconnection logic, fallback transports, and room namespaces simplified multi-node worker management and live terminal streaming.
- Raw WebSockets
- gRPC over HTTP/2
Decouple Control Plane from Worker Nodes
Allows adding new worker servers across different geographic regions without modifying the main user dashboard.
Tech Stack
- TypeScript
- Next.js
- Node.js
- Express
- Socket.io
- Docker API
- MongoDB
- Linux SSH
- Tailwind CSS
Result & Impact
- < 3 secondsProvisioning Speed
- < 20ms (Real-time)Terminal Latency
- SSH (22) + HTTP (80/443)Port Forwarding
Designed and built an end-to-end cloud container platform that enables developers to launch and control remote Linux instances instantly.
Learnings
- Strict cgroups and memory/CPU limits are required when hosting user-submitted containers.
- Handling persistent WebSocket connections across worker nodes requires robust reconnection strategies.
System Architecture
DockHostV2 bridges web-based developer tooling with backend container infrastructure.
Core Architecture Components
- Control Plane (Next.js & Express): Handles user authentication, container scheduling, database state, and routing.
- Worker Node Agents: Lightweight daemons running on worker servers that interact directly with the local Docker daemon socket (
/var/run/docker.sock). - Interactive Web Terminal: Streams PTY terminal IO between the web browser and the container’s bash session using xterm.js and Socket.io.