Last active
October 12, 2023 19:08
-
-
Save Decicus/5e2de0ef5cb743e1b97b61ece5631216 to your computer and use it in GitHub Desktop.
Docker Compose file for routing Plex via VPN. Loosely based on: https://wiki.alex.lol/books/justsysadminthings/page/docker-vpn-with-port-forwarding-wireguard-qbittorrent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
vpn: | |
container_name: wireguard | |
image: jordanpotter/wireguard | |
cap_add: | |
- NET_ADMIN | |
- SYS_MODULE | |
sysctls: | |
net.ipv4.conf.all.src_valid_mark: 1 | |
net.ipv6.conf.all.disable_ipv6: 0 | |
volumes: | |
# Your WireGuard configuration file. Can be from any provider that allows you to generate WireGuard configurations for connections (e.g. Mullvad, AirVPN). | |
# Heck, you can even set up a cheap VPS elsewhere and run Nyr's WireGuard install script on it: https://github.com/Nyr/wireguard-install | |
# The VPN service does *not* need to support port forwarding. | |
- ./wireguard_vpn.conf:/etc/wireguard/vpn.conf | |
ports: | |
# Expose the Plex port locally, so the host can reverse proxy it. | |
# In my case I have NGINX installed directly on the host and not in a container by itself. | |
# If you run NGINX Proxy Manager or similar, you might have to mess with Docker networking. | |
- "127.0.0.1:32400:32400" | |
restart: unless-stopped | |
plex: | |
image: plexinc/pms-docker:latest | |
container_name: plex | |
depends_on: | |
- vpn | |
# The important line, makes all network traffic for the Plex container go through the VPN container. | |
network_mode: "service:vpn" | |
environment: | |
# Uncomment and set these variables as necessary. You may have to check with `id plex`, if migrating from a regular installation to Docker | |
# - PUID=112 | |
# - PLEX_UID=112 | |
# - PGID=116 | |
# - PLEX_GID=116 | |
- VERSION=docker | |
# Leaving this here for documentation, but the `ports` will not work here. See the `vpn` container configuration | |
# ports: | |
# - "127.0.0.1:32400:32400" | |
volumes: | |
# `./config` is the equivalent of: /var/lib/plexmediaserver | |
# So once again, if you're migrating from a regular installation on Linux (e.g. via apt), you may want to change this to: | |
# - /var/lib/plexmediaserver:/config | |
- ./config:/config | |
#- /data/PlexMedia:/data/PlexMedia | |
#- /data/NotPorn:/data/NotPorn | |
restart: unless-stopped | |
# Intel iGPU transcoding: https://wiki.alex.lol/books/justsysadminthings/page/hetzner---using-igpu-for-hardware-acceleration | |
# devices: | |
# - /dev/dri:/dev/dri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment