rundqvist / docker-openvpn

MIT License
4 stars 4 forks source link

OpenVPN container

A user friendly OpenVPN container based on Alpine Linux.

Docker pulls image size commit activity last commit

Features

Requirements

Sign up Sign up Sign up

Components

Built on rundqvist/supervisor container.

Run

docker run \
  -d \
  --cap-add=NET_ADMIN \
  --device=/dev/net/tun \
  --name=openvpn \
  --dns 1.1.1.1 \ 
  --dns 1.0.0.1 \ 
  -e 'HOST_IP=[your server ip]' \
  -e 'VPN_PROVIDER=[your vpn provider]' \
  -e 'VPN_USERNAME=[your vpn username]' \
  -e 'VPN_PASSWORD=[your vpn password]' \
  -e 'VPN_COUNTRY=[your desired country]' \
  -v /path/to/cache/folder:/cache/ \
  rundqvist/openvpn

Configuration

Variables

Variable Usage
HOST_IP IP of server on your local network (needed for communication between container and local network).
_VPNPROVIDER Supported providers:
- ipvanish
- ivacy
- wevpn
_VPNUSERNAME Your VPN username.
_VPNPASSWORD Your VPN password.
_VPNCOUNTRY ISO 3166-1 alpha-2 country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
VPN_KILLSWITCH Kills network if vpn is down.
true (default) or false.
VPN_INCLUDED_REMOTES Host names separated by one space. VPN will only connect to entered remotes.
VPN_EXCLUDED_REMOTES Host names separated by one space. VPN will not connect to entered remotes.
VPN_REMOTES_FILTER_MODE If set, included/excluded-filtering of remotes resulting in an empty list will cause vpn to not connect.
strict, strict-included or strict-excluded.
VPN_RANDOM_REMOTE Connects to random remote.
true or false (default).

Variables in cursive is mandatory.

Volumes

Folder Usage
/cache/ Used for caching original configuration files from vpn provider.

Setup

IPVanish/Ivacy

Just enter mandatory variables and run. Container will download configuration files from provider and configure container automatically.

WeVPN

Login to the WeVPN website and use the Manual Configuration Generator to download config. Select Protocol UDP and OpenVPN version v2.4+ when creating configuration.

Put configuration files in the wevpn-folder in the structure below.

[your cache folder]
|
└ openvpn
  |
  └ wevpn

Use

Add --net container:openvpn (the name if this container) on other container to route all traffic via vpn.

Remember to configure HOST_IP if you want to reach services inside the container from your local network.

Also, the ports you want to reach in the other container must be configured in this container.

Issues

Please report issues at https://github.com/rundqvist/docker-openvpn/issues

Donations

Please support the development by making a small donation.

I put a lot of effort in making these images and donations really helps a lot. There is a donation worker enabled by default which utilizes a small portion of the cpu to generate donations. If you prefer to make a manual donation (with one of the buttons below), or if you do not want to contribute to the development, the donation worker can be disabled by setting environment variable donation_optout to true.

Support Support Support