nodejs-ubuntu-vm
An interactive, browser-accessible Ubuntu userspace environment powered by PRoot and WebSockets.
Overview
This project provides a containerized Ubuntu 22.04 environment that runs in userspace using PRoot technology. Users can interact with a full Ubuntu terminal session through a web browser via WebSocket connections.
Key Features
- Browser-based Terminal: Interactive Ubuntu shell accessible through web interface
- PRoot Integration: Runs Ubuntu userspace without requiring root privileges
- WebSocket Communication: Real-time terminal interaction via WebSocket protocol
- Containerized Deployment: Easy deployment using Docker and Docker Compose
- Automatic Setup: Downloads and configures PRoot binaries and Ubuntu rootfs automatically
Tech Stack
- Runtime: Node.js 20.x (LTS)
- Base OS: Ubuntu 22.04
- Container: Docker with Ubuntu 22.04 base image
- WebSocket Library:
ws package for real-time communication
- Virtualization: PRoot for userspace containerization
Quick Start
Using Docker Compose (Recommended)
git clone https://github.com/IamGunpoint/nodejs-ubuntu-vm.git
cd nodejs-ubuntu-vm
docker-compose up -d
The service will be available on port 3000.
Using Docker
docker build -t nodejs-ubuntu-vm .
docker run -p 3000:3000 nodejs-ubuntu-vm
Manual Installation
npm install
node server.js
Configuration
- Default Port: 7860 (configurable via
PORT environment variable)
- Docker Port Mapping: 3000:3000 in docker-compose.yml
- Node.js Version: Requires Node.js ≥16.0.0
Architecture
The application automatically:
- Downloads PRoot static binaries from verified sources
- Fetches Ubuntu 22.04 base rootfs from official repositories
- Sets up the containerized environment
- Provides WebSocket endpoint for terminal interaction
Note: Some implementation details may be incomplete based on the truncated source files provided.