A multi-tenant remote shell platform built with Go that dynamically provisions isolated Docker containers per session and provides full terminal access over TCP connections.
-
π Multi-Tenant Architecture
Handles multiple client sessions simultaneously, each in an isolated Docker container. -
βοΈ Dynamic Docker Provisioning
Automatically creates and starts a fresh Ubuntu-based Docker container for each new incoming connection. -
π» PTY Support
Uses creack/pty to provide fully interactive Bash shells with support for:- Shell prompts
- Line editing
- Signal handling (Ctrl+C, etc.)
-
π Bidirectional I/O Streaming
Bridges the TCP connection with the containerβs PTY master usingio.Copy
for low-latency, real-time interaction. -
β± Automatic Session Expiry
Usescontext.WithTimeout
to enforce time limits on sessions and automatically clean up containers after timeout.
- Listens on a TCP port for incoming client connections.
- Upon connection, spawns a new Docker container running an interactive Bash shell.
- Sets up a PTY inside the container and bridges it with the client over TCP.
- Automatically tears down the session and container after the allocated time.
- Language: Go
- Containerization: Docker
- Terminal Emulation: creack/pty
- Concurrency: Goroutines and context for timeouts
- Docker installed and running
- Go installed (
go 1.20+
recommended)
go run main.go