Docker image that establishes a VPN connection through OpenVPN and provides a SOCKS5 proxy.
1.1K
Docker container that establishes a VPN connection through OpenVPN and provides a SOCKS5 proxy that only works when the VPN is active. SOCKS5 supports any type of traffic (TCP/UDP), making it more versatile than HTTP proxies.
NET_ADMIN and /dev/net/tunThe architectures supported by this image are:
| Architecture | Available |
|---|---|
| arm64 | ✅ |
| amd64 | ✅ |
| Release | Image | OpenVPN | go-socks5-proxy |
|---|---|---|---|
1.0.0 | 3.23-d34fa4d2-ls4 | 2.6.16-r0 | 1.0.0 |
| Variable | Required | Description | Default |
|---|---|---|---|
OPENVPN_CONFIG | ✅ Yes | OpenVPN filename (must be in /config/openvpn/) | - |
TZ | ❌ No | Timezone | Europe/Lisbon |
PUID | ❌ No | User ID | 1000 |
PGID | ❌ No | Group ID | 1000 |
LOG_ROTATE_DAYS | ❌ No | Number of days to keep rotated logs | 7 |
VPN_ENABLED | ❌ No | Enable/disable VPN (set to false to test proxy without VPN) | true |
PROXY_PORT | ❌ No | SOCKS5 proxy port | 1080 |
PROXY_ALLOWED_NETWORKS | ❌ No | Allowed networks (space separated) | 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 |
VPN_CHECK_INTERVAL | ❌ No | VPN check interval (seconds) | 5 |
VPN_CHECK_HOST | ❌ No | Host to check VPN connectivity | 8.8.8.8 |
services:
openvpn-proxy:
image: hbixu/openvpn-proxy:latest
container_name: openvpn-proxy
cap_add:
- NET_ADMIN
- SYS_MODULE
devices:
- /dev/net/tun
volumes:
- ./openvpn-configs:/config/openvpn:ro
- ./logs:/var/log
environment:
# OpenVPN configuration filename (must be in ./openvpn-configs/)
- OPENVPN_CONFIG=config.ovpn
# Timezone (default: Europe/Lisbon, defined in Dockerfile)
- TZ=Europe/Lisbon
# User ID and Group ID (default: 1000, defined in Dockerfile)
- PUID=1000
- PGID=1000
# Log rotation: number of days to keep logs
- LOG_ROTATE_DAYS=7
# Enable/disable VPN (set to "false" to test proxy without VPN)
# When false: proxy starts immediately without VPN connection
- VPN_ENABLED=true
# Optional: Override defaults from Dockerfile (uncomment if needed)
# - PROXY_PORT=1080 # Default: 1080
# - PROXY_ALLOWED_NETWORKS=10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
# - VPN_CHECK_INTERVAL=5 # Default: 5 seconds
# - VPN_CHECK_HOST=8.8.8.8 # Default: 8.8.8.8
ports:
- "1080:1080" # Host port 1080 -> Container port 1080
restart: unless-stopped
# Healthcheck - verifies if OpenVPN and proxy are working
healthcheck:
test: ["CMD", "/root/healthcheck.sh"]
interval: 30s
timeout: 10s
start_period: 60s
retries: 3
# DNS configuration
# Para usar AdGuard Home no router, adicione o IP do router como primeiro DNS
# Exemplo: dns: [ "192.168.1.1", "8.8.8.8", "1.1.1.1" ]
# Para descobrir o IP do router: ip route | grep default
dns:
- 8.8.8.8 # Google DNS
- 8.8.4.4 # Google DNS (backup)
- 1.1.1.1 # Cloudflare DNS (backup)
networks:
- vpn-network
networks:
vpn-network:
driver: bridge
This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007.
Content type
Image
Digest
sha256:ae5b7243e…
Size
15.1 MB
Last updated
8 months ago
docker pull hbixu/openvpn-proxy