This example demonstrates running a complete desktop environment (XFCE) in OpenSandbox with VNC access, enabling GUI applications and remote desktop functionality.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/alibaba/OpenSandbox/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The desktop sandbox image includes:- Xvfb (virtual framebuffer X server)
- x11vnc (VNC server)
- XFCE desktop environment (panel, file manager, terminal)
- noVNC and websockify for browser-based VNC access
- Non-root user (
desktop) for security
Building the Image
Build the desktop sandbox image from the Dockerfile:Pull Pre-built Image
Alternatively, pull the pre-built image:Setup OpenSandbox Server
Start the local OpenSandbox server:Complete Example
This example creates a full desktop environment accessible via both native VNC clients and web browsers:Example Output
The script will start all desktop components and output the access URLs:Screenshots
Terminal Output
noVNC Connection
Password Entry
Full Desktop
Features
Full Desktop Environment
- Complete XFCE desktop with panel, menus, and taskbar
- File manager for browsing files
- Terminal emulator for command-line access
- Window management and desktop customization
Dual Access Methods
- Native VNC: Connect with any VNC client (TigerVNC, RealVNC, etc.)
- Browser-based: Access through noVNC in any web browser
Display Configuration
- Virtual display runs at 1280x800x24 (configurable)
- Xvfb provides framebuffer without GPU
- Headless operation, no physical display needed
Environment Variables
| Variable | Default | Description |
|---|---|---|
SANDBOX_DOMAIN | localhost:8080 | OpenSandbox server address |
SANDBOX_API_KEY | - | API key for authentication |
SANDBOX_IMAGE | opensandbox/desktop:latest | Docker image to use |
VNC_PASSWORD | opensandbox | Password for VNC access |
PYTHON_VERSION | 3.11 | Python version in sandbox |
Customization
Display Resolution
Change the virtual display resolution:VNC Server Options
Customize x11vnc behavior:| Option | Description |
|---|---|
-forever | Keep server running after client disconnect |
-shared | Allow multiple simultaneous connections |
-noxdamage | Disable X DAMAGE extension (may improve performance) |
-rfbport | Port to listen on |
Running GUI Applications
Launch GUI applications in the desktop:Use Cases
GUI Application Testing
- Test desktop applications in isolated environments
- Capture screenshots and videos of application behavior
- Automate GUI testing workflows
- Support multiple display configurations
Remote Development
- Provide full desktop environments to developers
- Access graphical development tools remotely
- Run IDE, debugger, and profiler with GUI
- Collaborate on visual debugging
AI Agent Interfaces
- Enable AI to interact with GUI applications
- Visual task automation and testing
- Screen capture for vision models
- Computer use demonstrations
Education and Training
- Provide pre-configured desktop environments
- Students access consistent environments
- Safe experimentation without affecting local systems
- Easy reset and reproducibility
Component Details
Xvfb (X Virtual Framebuffer)
- Provides X11 display without physical screen
- Runs entirely in memory
- Supports full X11 protocol
- No GPU required
x11vnc
- VNC server for X11 displays
- Shares existing X session
- Password protection support
- Multiple client connections
XFCE Desktop
- Lightweight desktop environment
- Low resource requirements
- Fast startup time
- Familiar desktop paradigm
noVNC
- HTML5 VNC client
- No client installation required
- Works in any modern browser
- WebSocket-based connection
Security Considerations
- VNC Password: Change default password for production use
- Network Isolation: Sandbox provides network isolation
- User Permissions: Runs as non-root
desktopuser - TLS/SSL: Consider adding encryption for production
- Temporary Sessions: Destroy sandboxes after use
Performance Tips
- Lower resolution for better performance (800x600x16)
- Disable XFCE compositor for reduced CPU usage
- Use
-noxdamageflag with x11vnc - Limit number of concurrent sessions
- Consider using a more lightweight window manager