Docker container to run Python CLI applications (games, scripts) with VNC access via web browser. Optimized for ARM64 devices like BananaPi M5.
- ๐ฎ Run any Python CLI application with
.venvsupport - ๐ฅ๏ธ Lightweight LXDE Desktop Environment - Full desktop experience optimized for ARM64
- ๐ Access via browser using noVNC (no VNC client needed)
- ๐จ Full terminal color support (256 colors)
- ๐ Optional audio support via PulseAudio
- ๐ Password-protected VNC access (optional)
- ๐ Git repository cloning on startup (alternative to volume mount)
- โก Optimized for ARM64 (BananaPi M5)
- ๐ฆ Easy deployment via Portainer
- Docker & Docker Compose
- Python project with:
__main__.py(entry point)requirements.txt(optional - automatically installs dependencies)- Optional:
.env(project-specific config)
Two deployment modes:
- Volume Mount: Mount local Python project directory
- Git Clone: Automatically clone from GitHub/GitLab on container start
Note: The .venv virtual environment is created automatically on startup if it doesn't exist.
Choose one of two methods:
- Clone this repository:
git clone <your-repo-url>
cd python-vnc-bridge- Edit docker-compose.yml:
volumes:
- /path/to/your/python/game:/app # <-- Point to your Python project
environment:
- VNC_PASSWORD=your_password # Optional
- DEBUG=true # Enable detailed logging (optional)- Start container:
docker-compose up -d- Edit docker-compose.yml:
# Comment out or remove volumes section
# volumes:
# - ./app:/app
environment:
- VNC_PASSWORD=your_password # Optional
- GIT_REPO=https://github.com/username/your-python-game.git
- GIT_BRANCH=main # Optional, defaults to main
# For private repos:
# - GIT_USERNAME=your-github-username
# - GIT_TOKEN=ghp_your_personal_access_token- Start container:
docker-compose up -dThe container will automatically clone your repository to /project on startup.
Important:
- Volume mounts use
/appdirectory - Git clones use
/projectdirectory
Open: http://localhost:6080
Enter your VNC password (if configured).
Set these in docker-compose.yml or Portainer Stack environment section:
| Variable | Default | Description |
|---|---|---|
DEBUG |
false | Enable detailed debug logging (true/false) |
VNC_PASSWORD |
(empty) | VNC access password (optional, leave empty for no authentication) |
VNC_PORT |
5900 | VNC server port |
NOVNC_PORT |
6080 | noVNC web interface port |
DISPLAY_WIDTH |
800 | Display width in pixels |
DISPLAY_HEIGHT |
600 | Display height in pixels |
VNC_FPS |
15 | Frame rate (lower = better performance) |
ENABLE_AUDIO |
false | Enable audio support (impacts performance) |
VNC_COLOR_DEPTH |
16 | Color depth (16 or 24 bit) |
START_PYTHON_APP |
true | Auto-start Python app in desktop terminal |
| Variable | Default | Description |
|---|---|---|
GIT_REPO |
(empty) | Git repository URL (HTTPS). If set, clones to /project on startup |
GIT_BRANCH |
main |
Branch to clone (optional) |
GIT_USERNAME |
(empty) | GitHub username for private repositories (optional) |
GIT_TOKEN |
(empty) | Personal Access Token for private repositories (optional) |
Note: If GIT_REPO is set, the container will clone the repository on startup instead of using volume mount.
For better performance on ARM devices:
- Keep
VNC_FPS=15or lower - Use
VNC_COLOR_DEPTH=16 - Disable audio if not needed:
ENABLE_AUDIO=false - Reduce resolution:
DISPLAY_WIDTH=640 DISPLAY_HEIGHT=480
- In Portainer, go to Stacks โ Add Stack
- Choose Repository as build method
- Enter your Git repository URL
- Set Compose path:
docker-compose.yml - In the Environment variables section, add (all optional):
VNC_PASSWORD(leave empty for no password)NOVNC_PORT(default: 6080)- Other settings as needed
- Important: Edit the volume path in the stack editor:
volumes: - /your/actual/path:/app # For volume mount
- Deploy!
Two directories are used depending on deployment mode:
The container expects your Python project at /app:
volumes:
- /home/user/my-game:/app # Host path : Container pathThe container clones to /project automatically. No volume mount needed.
Required project structure:
/app/ (or /project/)
โโโ __main__.py # Required: Entry point
โโโ requirements.txt # Optional: Auto-installed on startup
โโโ .env # Optional: Project-specific config
Note: The .venv directory is created automatically on first startup.
python-vnc-bridge/
โโโ Dockerfile # Container definition
โโโ docker-compose.yml # Service configuration
โโโ entrypoint.sh # Startup script
โโโ .env.example # Environment reference (optional)
โโโ .gitignore # Git ignore rules
โโโ README.md # Setup documentation
โโโ WEBSITE_INTEGRATION.md # Website integration guide
VNC password is optional. Leave VNC_PASSWORD empty for open access, or set it in docker-compose.yml environment section.
- For volume mount: Check volume mount path in
docker-compose.ymlpoints to your Python project at/app - For git clone: Ensure your repository contains
__main__.pyin the root directory
Enable debug mode to see detailed information:
environment:
- DEBUG=trueThe .venv is created automatically on container startup. If you have requirements.txt, dependencies will be installed automatically.
Check logs:
docker-compose logs -fVerify __main__.py is executable:
python __main__.py # Test locally first- Lower FPS:
VNC_FPS=10 - Reduce resolution:
DISPLAY_WIDTH=640 DISPLAY_HEIGHT=480 - Disable audio:
ENABLE_AUDIO=false - Use 16-bit color:
VNC_COLOR_DEPTH=16
- Check ports are not blocked:
http://<bananapi-ip>:6080 - Verify container is running:
docker-compose ps - Check firewall settings on BananaPi
- Base Image: Debian Bookworm Slim
- Desktop Environment: LXDE (Lightweight X11 Desktop Environment)
- VNC Server: TigerVNC
- Web Interface: noVNC + websockify
- Display: Xvfb (virtual framebuffer)
- Terminal: lxterminal with 256-color support
- Audio: PulseAudio (optional)
- ARM64/aarch64 native (BananaPi M5)
- Also works on AMD64/x86_64
- Warning: VNC password is optional but recommended for production
- Set a strong
VNC_PASSWORDwhen exposing to network - Don't expose VNC ports directly to the internet without authentication
- Use reverse proxy (nginx, Traefik) with HTTPS for production
- Consider adding HTTP basic auth for noVNC endpoint
MIT
Issues and pull requests welcome!