🇰🇷 한êµì–´ 보기
A Docker-based system providing a real-time web address access–based virtual monitor using VNC/noVNC, composed of two containers: vnc and agent. The vnc container runs the virtual display server and VNC services, while the agent container executes browser automation scripts such as agent.py. The two containers communicate via a shared X11 UNIX socket volume, ensuring session isolation and security.
When a user requests the execution of a browser-use task, the orchestrator triggers the creation of a new session. For each session, a VNC/agent container pair is launched independently, and a real-time virtual monitor screen is provided via noVNC. Each session runs completely isolated using Docker namespaces and dedicated X11 socket volumes, ensuring that display data is securely separated between sessions.
- Xvfb: Virtual display server (e.g., :99)
 - x11vnc: VNC server
 - websockify: Converts VNC to WebSocket for noVNC access
 
- Executes browser-use Python scripts (e.g., 
agent.py) - Shares the X11 socket volume with the 
vnccontainer to render output to the virtual display 
- Docker & Docker Compose
 - git
 - Python 3.8 or higher
 
git clone https://github.com/squatboy/browser-use-vnc.git
cd browser-use-vnc/agent/.env: Write the LLM API KEY to be used by Browser-Use.- Browser-Use agent script file: 
agent/agent.py orchestrator/.env: SpecifyPUBLIC_HOST=<Server public IP or domain>(must be set in this file; used by the orchestrator to generate the noVNC access URL).
These files are automatically loaded by Docker Compose to configure and run the agent and orchestrator containers.
To run the orchestrator service that manages session creation, follow these steps:
- Create and activate a Python virtual environment inside the 
orchestrator/folder:cd orchestrator python3 -m venv .venv source .venv/bin/activate
 - Upgrade pip and install dependencies from 
requirements.txt:pip install -U pip pip install -r requirements.txt
 - Run the FastAPI server using uvicorn:
uvicorn app_orchestrator:app --host 0.0.0.0 --port 8000 --reload
 
Send a POST request to create a new VNC/agent session:
curl -X POST http://<Server-IP>:8000/sessionsThe response includes the session ID and the dynamically assigned noVNC url
Example Response:
{
  "session_id": "1a2b3c4d",
  "novnc_url": "http://<Server-IP>:6081/vnc.html?autoconnect=true&resize=scale"
}Open the provided URL in your web browser to connect to the virtual monitor via noVNC.
Without using orchestration, you can manually create multiple independent sessions by specifying different SESSION_ID and NOVNC_PORT environment variables and running separate Docker Compose projects.
# First session
cd vnc/
SESSION_ID=session1 NOVNC_PORT=6081 docker compose -p vnc1 up -d --build
# Second session
SESSION_ID=session2 NOVNC_PORT=6082 docker compose -p vnc2 up -d --build
Then connect to each session:
- http://:6081/vnc.html
 - http://:6082/vnc.html
 
Each session uses its own dedicated X11 socket volume, ensuring isolation with no data leakage between sessions.
When deploying on a public server, open only the noVNC ports required for your sessions (e.g., 6080, 6081, 6082, ...). Restrict access as necessary for security.
When running browsers inside the agent container, use the following settings to avoid common Docker-related issues:
browser_session = BrowserSession(
    headless=False,
    args=[
        "--no-sandbox",            # Required when running as root in Docker
        "--disable-dev-shm-usage"  # Prevent crashes with limited /dev/shm in containers
    ],
)- The system separates the 
vnccontainer (virtual display and VNC services) and theagentcontainer (browser automation scripts). - Extend or modify the agent scripts (
agent.py) to fit your automation workflows. - The agent container connects to the shared X11 socket volume to render browser output on the virtual display managed by the vnc container.
 
Embed the noVNC web client in an iframe to integrate the remote desktop directly into your web application:
<iframe
    src="http://<Server-IP>:6080/vnc.html?autoconnect=true"
    width="1280" height="720">
</iframe>- Chrome fails to launch: Restart the containers with 
docker compose restart. - VNC connection fails: Check whether inbound traffic on the noVNC ports is allowed by your firewall or security group.
 
- Each session is isolated via Docker namespaces and dedicated X11 socket volumes.
 - Communication between the 
agentandvnccontainers occurs only through the X11 UNIX socket, not over the network. - You can freely add or modify agent-side scripts and dependencies to fit your use case.
 

