3.5 KiB
3.5 KiB
Private Internet Access Docker (OpenVPN, Alpine)
VPN client container to private internet access servers based on Alpine Linux and OpenVPN
It requires:
The PIA configuration files are downloaded from the PIA website when the Docker image gets built.
Installation & Testing
- Run the tun.sh script on your host machine to ensure you have the tun device setup
sudo chmod +x tun.sh ./tun.sh - Obtaining the Docker image
- Option 1 of 2: Docker Hub Registry
-
You can check my Docker Hub page for more information.
-
In a terminal, download the image with:
sudo docker pull qmcgaw/private-internet-access
-
- Option 2 of 2: Build the image
- Download the repository files or
git clonethem - With a terminal, go in the directory where the Dockerfile is located
- Build the image with:
sudo docker build -t qmcgaw/private-internet-access ./
- Download the repository files or
- Option 1 of 2: Docker Hub Registry
- Create a file auth.conf in
/yourhostpath(for example), with:- On the first line: your PIA username (i.e.
js89ds7) - On the second line: your PIA password (i.e.
8fd9s239G)
- On the first line: your PIA username (i.e.
- Test the container by connecting another container to it
- Run the container interactively with (and change the
/yourhostpath/auth.conf):Wait about 5 seconds for it to connect to the PIA server.sudo docker run --rm --name=piaTEST --cap-add=NET_ADMIN --device=/dev/net/tun --dns 209.222.18.222 --dns 209.222.18.218 -e 'REGION=Romania' -v '/yourhostpath/auth.conf:/pia/auth.conf' qmcgaw/private-internet-access - Check your host IP address with:
curl -s ifconfig.co - Run the curl Docker container using your piaTEST container with:
If the displayed IP address appears and is different that your host IP address, your PIA OpenVPN client works !
sudo docker run --rm --net=container:piaTEST tutum/curl curl -s ifconfig.co
- Run the container interactively with (and change the
- Run the container as a daemon in the background with (and change the
/yourhostpath/auth.conf):sudo docker run -d --restart=always --name=pia --cap-add=NET_ADMIN --device=/dev/net/tun --dns 209.222.18.222 --dns 209.222.18.218 -e 'REGION=Romania' -v '/yourhostpath/auth.conf:/pia/auth.conf' qmcgaw/private-internet-access
Connect other containers to it
Connect other Docker containers to the VPN connection by adding --net=container:pia when launching them.
Container launch parameters
- You can change the
--name=parameter to anything you like - You can change the
REGION=parameter to one of the regions supported by private internet access - You must adapt the
/yourhostpath/auth.confpath to your host path where you createdauth.conf

