Post

Install & configure Gluetun in Docker

Install & configure Gluetun in Docker

Very cool service to add a VPN connection to your other services if needed. Downloaders maybe a good example. ;o)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
services:
  gluetun:
    image: qmcgaw/gluetun:latest
    container_name: gluetun
    #    privileged: true
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    networks:
      - proxy
    ports:
      # - 8888:8888/tcp # HTTP proxy
      # - 8388:8388/tcp # Shadowsocks
      # - 8388:8388/udp # ShadowsocksShadowsocks
      - 8000:8000/tcp # http control server
      - 5959:8080 # sabnzbd
      - 8112:8112 # deluge
      - 6881:6881
      - 6881:6881/udp
    volumes:
      - ./config:/gluetun
    environment:
      # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
      - VPN_SERVICE_PROVIDER=${provider}
      - OPENVPN_USER=${OVPN_USER}
      - OPENVPN_PASSWORD=${OVPN_PASS}
      - SERVER_COUNTRIES=${Country}
      - TZ=${TZ}
      - BLOCK_MALICIOUS=on
      - BLOCK_SURVEILLANCE=on
      - FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24,172.25.0.0/16
    restart: always
networks:
  proxy:
    driver: bridge
    external: true

FIREWALL_OUTBOUND_SUBNETS = Whitelisted local networks. See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup to configuarate your VPN-provider.

You must remove the ports-section of every container attached to Gluetun.

Usage

On every container you want to attach you have to set -n container:gluetun or network-mode: container:gluetun if you use compose.

This post is licensed under CC BY 4.0 by the author.