A minimal Docker container with:
- Playwright for browser automation
- X11VNC for visual monitoring
- NoVNC for web-based VNC access
- JupyterLab for interactive coding
# Make scripts executable first
chmod +x build.sh start-vnc.sh
# Build and run
./build.sh# Make scripts executable first
chmod +x docker-compose-run.sh start-vnc.sh
# Build and run with Docker Compose
./docker-compose-run.sh- JupyterLab: http://localhost:8888
- noVNC (web-based VNC viewer): http://localhost:6080
- Direct VNC: localhost:5900 (use any VNC viewer with password "password")
Dockerfile- Container definitiondocker-compose.yml- Service configurationsupervisord.conf- Process management configstart-vnc.sh- Script to initialize VNC servicesbuild.sh- Script to build and run using Dockerdocker-compose-run.sh- Script to build and run using Docker Composedata/- Persistent storage directorytest_notebook.ipynb- Sample Jupyter notebook for testingtest_playwright_vnc.py- Python script to test Playwright with VNC
Once the container is running, you can test that everything is working by:
- Open JupyterLab at http://localhost:8888
- Navigate to the
/app/data/test_notebook.ipynbfile - Run the cells in the notebook to test both Jupyter and VNC functionality
- Alternatively, run the test script directly with:
docker exec playwright-vnc python /app/data/test_playwright_vnc.py
Place your Playwright scripts in the container and run them through Jupyter. The browser will be visible through the VNC interface for debugging.
You can create a simple test script in Jupyter:
from playwright.sync_api import sync_playwright
def run(playwright):
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto('https://example.com')
page.screenshot(path='/app/data/screenshot.png')
browser.close()
with sync_playwright() as playwright:
run(playwright)