protonvpn
Minimal ProtonVPN Docker Image for use with other Containers
10K+
This Docker image provides a lightweight and secure solution to connect your containers to ProtonVPN.
AUTH_USER_PASS_FILE environment variable to the file path.OPENVPN_USER and OPENVPN_PASS environment variables with your
credentials.network_mode: service:protonvpn option in your Docker Compose configuration for
containers requiring VPN protection.HTTP_PROXY environment variable to 1 and map port 3128 to use the VPN in any
application with HTTP(S) proxy support.Important
Since containers share the network stack when using `network_mode`, the port mappings for services requiring external access need to be defined on the ProtonVPN container.
services:
protonvpn:
image: genericmale/protonvpn
restart: unless-stopped
environment:
- OPENVPN_USER_PASS_FILE=/run/secrets/protonvpn
- VPN_RECONNECT=2:00
- VPN_SERVER_COUNT=10
ports:
- 8118:8118 # Privoxy Port
volumes:
- /etc/localtime:/etc/localtime:ro
devices:
- /dev/net/tun
cap_add:
- NET_ADMIN
secrets:
- protonvpn
privoxy:
image: vimagick/privoxy
restart: unless-stopped
network_mode: service:protonvpn
depends_on:
protonvpn:
condition: service_healthy
secrets:
protonvpn:
file: protonvpn.auth
This configuration achieves the following:
VPN_SERVER_COUNT=10 to randomly selects one of the 10 fastest servers.VPN_RECONNECT=2:00 to rotate servers.network_mode: service:protonvpn)depends_on and condition: service_healthy.services:
protonvpn:
image: genericmale/protonvpn
restart: unless-stopped
environment:
- OPENVPN_USER_PASS_FILE=/run/secrets/protonvpn
- HTTP_PROXY=1
ports:
- 3128:3128
volumes:
- /etc/localtime:/etc/localtime:ro
devices:
- /dev/net/tun
cap_add:
- NET_ADMIN
secrets:
- protonvpn
secrets:
protonvpn:
file: protonvpn.auth
| Variable | Default | Description |
|---|---|---|
| OPENVPN_USER_PASS_FILE | /etc/openvpn/protonvpn.auth | Path to a file containing your OpenVPN username and password on separate lines. |
| OPENVPN_USER | (undefined) | Username for authentication. Will be used to create OPENVPN_USER_PASS_FILE if it doesn't exist. |
| OPENVPN_PASS | (undefined) | Password for authentication. Will be used to create OPENVPN_USER_PASS_FILE if it doesn't exist. |
| OPENVPN_EXTRA_ARGS | (undefined) | Additional arguments to pass to the OpenVPN command. |
| PROTON_TIER | 2 | Your Proton Tier. Valid values: 0 (Free), 1 (Basic), 2 (Plus), 3 (Visionary) |
| IP_CHECK_URL | https://ifconfig.co/json | URL to check for a new IP address after connecting to the VPN. Unset to disable. |
| CONNECT_TIMEOUT | 60 | Maximum time in seconds to wait for a new IP before a reconnect is triggered. |
| VPN_SERVER_FILTER | . | Optional JQ filter to apply to the server list returned by the API. By default, servers are ranked by their score (closest/fastest on top). |
| VPN_SERVER_COUNT | 1 | Number of top servers (from the filtered list) to pass to OpenVPN. One server from this list will be randomly chosen for connection. |
| VPN_RECONNECT | (undefined) | Optional time to schedule automatic reconnection. Either HH:MM for a daily reconnect at a fixed time, or a duration to wait (e.g. 30m, 12h). |
| VPN_KILL_SWITCH | 1 | When enabled (1), disconnects the network when the VPN drops. Set to 0 to disable. |
| HTTP_PROXY | 0 | When enabled (1), starts tinyproxy on port 3128. |
The VPN_SERVER_FILTER environment variable allows you to filter available ProtonVPN servers using JQ queries.
Some examples:
# Fastest Servers from Germany
- VPN_SERVER_FILTER=map(select(.ExitCountry == "DE"))
# Servers with Lowest Load
- VPN_SERVER_FILTER=sort_by(.Load)
# Specific server
- VPN_SERVER_FILTER=map(select(.Name == "GR#3"))
# Fastest Servers from Berlin with Load <50%
- VPN_SERVER_FILTER=map(select(.City == "Berlin" and .Load < 50))
# Fastest Servers from Different Countries
- VPN_SERVER_FILTER=group_by(.ExitCountry) | map(.[0]) | sort_by(.Score)
To build the image, the following command can be used (adapt tag name to your liking):
docker image build . -t protonvpn
Content type
Image
Digest
sha256:c170e9b44…
Size
5.6 MB
Last updated
almost 2 years ago
docker pull genericmale/protonvpn