Another guide, this time to host gluetun in a dokku container,
so you can easily route individual dokku containers through a VPN!
Due to no clear documentation for this being available on the web,
I've decided to write out some of my own after finally succeeding with my own setup.
Following prerequisites fall out of the scope of this installation guide:
- Git
- Docker
- Dokku
- Linked domain name (e.g. my-dokku-server.com)
- SSL Certification (e.g. LetsEncrypt, Cloudflare, ...)
- Ledokku (Optional)
-
1.1. Create a
gluetundokku app:
(If usingledokku, then use GUI instead, to create thegluetunapp!)dokku apps:create gluetun
-
1.2. Setup
volumesto assure settings & storage will stick upon container re-creation:sudo mkdir -p /var/lib/dokku/data/storage/gluetun sudo chown dokku:dokku /var/lib/dokku/data/storage/gluetun/ dokku storage:mount gluetun /var/lib/dokku/data/storage/gluetun/:/gluetun
-
1.3. Configure the required environment variables, change as needed:
This is an example using Perfect Privacy as the VPN provider.
Check the required environment variables for your VPN provider at theSetup/Providerssection of the Gluetun Wiki!dokku config:set --no-restart gluetun \ VPN_SERVICE_PROVIDER="perfect privacy" \ OPENVPN_USER="username-here" \ OPENVPN_PASSWORD="password-here" \ SERVER_CITIES="Amsterdam,Basel,Belgrade,Berlin,Bucharest,Calais,Chicago,Copenhagen,Dallas,Erfurt,Frankfurt,Hamburg,Hongkong,Istanbul,Jerusalem,London,LosAngeles,Madrid,Malmoe,Manchester,Miami,Milan,Montreal,Moscow,NewYork,Nuremberg,Oslo,Paris,Prague,Reykjavik,Riga,Rotterdam,Singapore,Stockholm,Sydney,Tokyo,Vienna,Warsaw,Zurich" \ TZ="UTC" -
1.4. Setup additional
deployandrundocker-options:# Allow modification of network interfaces on the host system: dokku docker-options:add gluetun deploy,run '--cap-add NET_ADMIN'
-
1.5. Disable the
weband enable aworkerprocess:dokku ps:scale gluetun worker=1 web=0
-
1.6. Deploy the latest
gluetundocker tag:dokku git:from-image gluetun qmcgaw/gluetun:latest
-
2.1. Create a
transmissiondokku app:
(If usingledokku, then use GUI instead, to create thetransmissionapp!)dokku apps:create transmission
-
2.2. Configure the required environment variables, change as needed or leave default:
dokku config:set --no-restart transmission \ USER="admin" \ PASS="password" -
2.3. Glue
transmissionto thegluetunnetwork!dokku docker-options:add transmission deploy,run '--network=container:gluetun.worker.1' -
2.4. Deploy the latest
transmissiondocker tag:dokku git:from-image transmission lscr.io/linuxserver/transmission:latest
-
2.5. Validate if
transmissionis being routed through thegluetunVPN connection:# Print out in which city the dokku host resides: curl -s ipinfo.io/json | grep city # Print out "in which city" the transmission container resides: dokku run transmission curl -s ipinfo.io/json | grep city
dokku ps:stop gluetun; sleep 2; docker pull qmcgaw/gluetun:latest; dokku ps:rebuild gluetunIf you're using fish as your shell,
then you can add these fish-functions to your ~/.config/fish/functions/ directory.
This will make following commands available under fish,
to ease up the usage of gluetun with dokku:
# Enable VPN for dokku app
dokku-app-vpn-enable <app-name>
# Disable VPN for dokku app
dokku-app-vpn-disable <app-name>
# Check current city of dokku app, requires curl + grep in container!
dokku-app-vpn-status <app-name>
# Updates Gluetun dokku app
dokku-update-gluetun