AutoBot uses VNC for browser automation and desktop viewing capabilities. This document explains how VNC ports are configured to avoid conflicts between host and container environments.
- Host VNC:
5900(Standard VNC port, often used by Kali Linux desktop) - Container VNC:
5901(Avoids conflict with host VNC) - NoVNC Web Interface:
6080(Web-based VNC viewer) - Playwright API:
3000(Browser automation API)
| Variable | Purpose | Default | Container | Host |
|---|---|---|---|---|
AUTOBOT_VNC_DISPLAY_PORT |
Host VNC display port | 5900 |
5900 |
5900 |
AUTOBOT_VNC_CONTAINER_PORT |
Container VNC port | 5901 |
5901 |
5901 |
AUTOBOT_PLAYWRIGHT_VNC_URL |
NoVNC web interface | http://localhost:6080/vnc.html |
Same | Same |
AUTOBOT_PLAYWRIGHT_API_URL |
Playwright API endpoint | http://localhost:3000 |
Same | Same |
AutoBot automatically detects the appropriate VNC port based on the environment:
- Container Detection: Checks for
/.dockerenvfile orDOCKER_CONTAINERenvironment variable - Port Availability: Tests if port 5900 is already in use
- Smart Selection:
- If in container → use
VNC_CONTAINER_PORT(5901) - If port 5900 is busy (host VNC active) → use
VNC_CONTAINER_PORT(5901) - Otherwise → use
VNC_DISPLAY_PORT(5900)
- If in container → use
from src.config import get_vnc_direct_url, get_vnc_display_port
# Get intelligent VNC connection URL
vnc_url = get_vnc_direct_url() # Returns vnc://localhost:5900 or vnc://localhost:5901
# Get the selected port number
port = get_vnc_display_port() # Returns 5900 or 5901- Host VNC: Running on port 5900 (Kali desktop)
- AutoBot: Detects port 5900 busy → uses port 5901
- Result:
vnc://localhost:5901
- Environment: Container detected via
/.dockerenv - AutoBot: Uses container port 5901 to avoid host conflicts
- Result:
vnc://localhost:5901(mapped from container)
- Host VNC: Not running (port 5900 free)
- AutoBot: Uses standard port 5900
- Result:
vnc://localhost:5900
# Override default ports
export AUTOBOT_VNC_DISPLAY_PORT=5902
export AUTOBOT_VNC_CONTAINER_PORT=5903- URL: http://localhost:6080/vnc.html
- Features: Browser-based VNC viewer
- Auto-connect:
?autoconnect=true&resize=scale
- URL:
vnc://localhost:{port}(determined automatically) - Clients: VNC Viewer, TightVNC, RealVNC
- Protocol: Standard VNC over TCP
# Check what's using port 5900
sudo netstat -tlnp | grep :5900
# Check what's using port 5901
sudo netstat -tlnp | grep :5901
# Test AutoBot's port detection
python3 -c "from src.config import get_vnc_display_port; print(f'Selected VNC port: {get_vnc_display_port()}')"- VNC Service Not Running: Start the appropriate VNC service
- Firewall Blocking: Allow VNC ports through firewall
- Wrong Port: Check which port AutoBot selected
- Container Mapping: Verify Docker port mappings match configuration
# docker-compose.yml
services:
autobot:
ports:
- "5901:5901" # VNC port (container internal)
- "6080:6080" # NoVNC web interface
- "3000:3000" # Playwright API- Local Only: Default configuration binds to localhost
- Remote Access: Set
AUTOBOT_VNC_HOST=0.0.0.0to allow remote connections - Authentication: Configure VNC password for security
- Port Mapping: Container ports are isolated from host
- Process Isolation: VNC processes run in container namespace
- Resource Limits: Docker resource constraints apply
# .env file for development
AUTOBOT_VNC_DISPLAY_PORT=5900
AUTOBOT_VNC_CONTAINER_PORT=5901
AUTOBOT_PLAYWRIGHT_VNC_URL=http://localhost:6080/vnc.html
AUTOBOT_PLAYWRIGHT_API_URL=http://localhost:3000# .env file for production
AUTOBOT_VNC_DISPLAY_PORT=15900
AUTOBOT_VNC_CONTAINER_PORT=15901
AUTOBOT_PLAYWRIGHT_VNC_URL=http://production-host:16080/vnc.html
AUTOBOT_PLAYWRIGHT_API_URL=http://production-host:13000# Instance 1
AUTOBOT_VNC_DISPLAY_PORT=5900
AUTOBOT_VNC_CONTAINER_PORT=5901
# Instance 2
AUTOBOT_VNC_DISPLAY_PORT=5902
AUTOBOT_VNC_CONTAINER_PORT=5903This intelligent port configuration ensures AutoBot works seamlessly in both host and container environments while avoiding common VNC port conflicts.